sort

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
2
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
814 B
Returns a copy of the list, sorted according to the comparator function,
1 contributor
Install sort as a package?
Copied
npm i @bit/justin-capalbo.ramda.sort
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
sort (
comparator:Function,
list:Array
) : Array

Returns a copy of the list, sorted according to the comparator function, which should accept two values at a time and return a negative number if the first value is smaller, a positive number if it’s larger, and zero if they are equal. Please note that this is a copy of the list. It does not modify the original.

Example
const diff = function(a, b) { return a - b; };
     R.sort(diff, [4,2,7,5]); //=> [2, 4, 5, 7]
Arguments
comparator: Function

A sorting function :: a -> b -> Int

list: Array

The list to sort

Returns
Array

a new array with its elements sorted by the comparator function.

Help and resources