partition

v0.9.6arrow_drop_down
v0.9.6
STATUS
Passing
DOWNLOADS
2
VISIBILITY
Public
PUBLISHED
5 years ago
SIZE
3 KB
Takes a predicate and a list or other `Filterable` object and returns the
1 contributor
Install partition as a package?
Copied
npm i @bit/justin-capalbo.ramda.partition
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
partition (
pred:Function,
filterable:Array
) : Array

Takes a predicate and a list or other Filterable object and returns the pair of filterable objects of the same type of elements which do and do not satisfy, the predicate, respectively. Filterable objects include plain objects or any object that has a filter method such as Array.

Example
R.partition(R.includes('s'), ['sss', 'ttt', 'foo', 'bars']);
     // => [ [ 'sss', 'bars' ],  [ 'ttt', 'foo' ] ]

     R.partition(R.includes('s'), { a: 'sss', b: 'ttt', foo: 'bars' });
     // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' }  ]
Arguments
pred: Function

A predicate to determine which side the element belongs to.

filterable: Array

the list (or other filterable) to partition.

Returns
Array

An array, containing first the subset of elements that satisfy the predicate, and second the subset of elements that do not satisfy.

Help and resources