Basic usage

Given an array of items return a new array sorted by the property specified in the get function. A third, and optional, argument allows you to get the sort in descending order.

import { sort } from 'radash'

const fish = [{
  name: 'Marlin',
  weight: 105
}, {
  name: 'Bass',
  weight: 8
}, {
  name: 'Trout',
  weight: 13

sort(fish, f => f.weight) // => [bass, trout, marlin]
sort(fish, f => f.weight, true) // => [marlin, trout, bass]


This _.sort function is 100% covered by tests. See them and contribute at GitHub.


See the source for _.sort on GitHub.