Share your code. Components are building blocks, you are the architect.

utils/sort-by
v1.1.0
1.1.0
1.0.0
MIT
PUBLIC
3
1     DEPENDENCIES
Build: fail
BuildFail
Build Status: fail
Sorts the list according to the supplied function.

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set '@bit:registry' https://node.bitsrc.io
Use utils/sort-by in your project
npm i @bit/bit.ramda.utils.sort-by
Copied

sortBy (fn:Function, list:Array) : Array

Sorts the list according to the supplied function.

Example

var sortByFirstItem = R.sortBy(R.prop(0));
     var sortByNameCaseInsensitive = R.sortBy(R.compose(R.toLower, R.prop('name')));
     var pairs = [[-1, 1], [-2, 2], [-3, 3]];
     sortByFirstItem(pairs); //=> [[-3, 3], [-2, 2], [-1, 1]]
     var alice = {
       name: 'ALICE',
       age: 101
     };
     var bob = {
       name: 'Bob',
       age: -10
     };
     var clara = {
       name: 'clara',
       age: 314.159
     };
     var people = [clara, bob, alice];
     sortByNameCaseInsensitive(people); //=> [alice, bob, clara]

Arguments

fn: Function

list: Array

The list to sort.

Returns

Array

A new list sorted by the keys generated by `fn`.