sort-with

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
2
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
853 B
Sorts a list according to a list of comparators.
1 contributor
Install sort-with as a package?
Copied
npm i @bit/justin-capalbo.ramda.sort-with
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
sortWith (
functions:Array,
list:Array
) : Array

Sorts a list according to a list of comparators.

Example
const alice = {
       name: 'alice',
       age: 40
     };
     const bob = {
       name: 'bob',
       age: 30
     };
     const clara = {
       name: 'clara',
       age: 40
     };
     const people = [clara, bob, alice];
     const ageNameSort = R.sortWith([
       R.descend(R.prop('age')),
       R.ascend(R.prop('name'))
     ]);
     ageNameSort(people); //=> [alice, clara, bob]
Arguments
functions: Array

A list of comparator functions.

list: Array

The list to sort.

Returns
Array

A new list sorted according to the comarator functions.

Help and resources