array-sort icon indicating copy to clipboard operation
array-sort copied to clipboard

Question: how to sort on both asc / desc

Open mesqueeb opened this issue 8 years ago • 1 comments

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'},
    ]);

mesqueeb avatar Oct 15 '17 05:10 mesqueeb

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.

doowb avatar Dec 06 '17 19:12 doowb