jashkenas / underscore

JavaScript's utility _ belt
https://underscorejs.org
MIT License
27.33k stars 5.53k forks source link

sort positive numbers first then, negative #2803

Closed chitgoks closed 5 years ago

chitgoks commented 5 years ago

is this possible using 1 inline code?

e.g.

1, 4, -8, 2, -1, 6

result

1, 2, 4, 6, -1, -8

AlisherAmonulloev commented 5 years ago

_.partition([1, 4, -8, 2, -1, 6].sort(), (n) => { return n > 0 }).join() Is this "inline" enough?

chitgoks commented 5 years ago

looks good thank you