array-sort
array-sort copied to clipboard
Question: how to sort on both asc / desc
Dear creator:
I'd want to use your plugin like so:
var result = arraySort(posts,
['locals.foo', 'locals.date'],
[{reverse: true}, {reverse: false}]
);
I'm sure this can be done with custom sorting, but it would be great if you could make this syntax work.
Or even better syntax imo:
var result = arraySort(posts, [
{field: 'locals.foo', direction: 'desc'},
{field: 'locals.date', direction: 'asc'},
]);
Thanks for the issue. I can see how these will make it easier to sort the way you'd prefer. I view these types of sorts working like sorting multiple columns in an Excel sheet. I'll try to work on this soon to see what I come up with unless anyone else wants to submit a PR with ideas.