Closed larsgw closed 7 years ago
Also, sort by custom comparison function.
Now implemented. Will push as soon as DOI is fixed and test cases and docs are ready. Syntax as above:
Regular:
const data = Cite(...)
data.sort(['author', 'year', 'title'])
Sort author reversed:
const data = Cite(...)
data.sort(['!author'])
Custom callback (same as callback for Array#sort()
):
const data = Cite(...)
data.sort((objA, objB) => Math.sign(Math.random() - .5))
Closed in e528dc919311576658124a7e60e866ecf132e6a8
Currently, sorting is done by BibTeX label. It would be nice if there's an option to sort as you want, for example first by author, then by year, then by title. Example API could be like this: