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

Feature Request: Add option for ASC/DESC

Open SippieCup opened this issue 8 years ago • 7 comments

Easy enough, but just adding a third function argument for sort direction.

SippieCup avatar May 17 '17 22:05 SippieCup

You can use the reverse option. This is the same as sorting in descending order. See the usage example to see if this is what you're looking for.

doowb avatar May 17 '17 22:05 doowb

Closing this... you can use reverse to get the array sorted in descending order.

doowb avatar Sep 11 '17 18:09 doowb

Sorry, Missed this before. didn't realize it was reverse until you told me and guess I never responded and thanked you.

too used to SQL...

Thanks.

SippieCup avatar Sep 27 '17 15:09 SippieCup

I hope you can change the syntax to direction: 'asc' and direction: 'desc', because lots of people are more used to this IMO!

mesqueeb avatar Oct 15 '17 07:10 mesqueeb

I agree with @doowb but also see the value of having asc/desc. I think we should consider adding those.

jonschlinkert avatar Oct 17 '17 05:10 jonschlinkert

I'll try to work on this sometime along with #9. I think there are concepts that we can look at to make this easier to do.

doowb avatar Dec 06 '17 19:12 doowb

You can try this arr-sort.

Sort an object array by one or more properties even nested properties. Besides, you can determine the direction even supply a comparison function in each property sorting.

tywei90 avatar Feb 12 '18 03:02 tywei90