How to use the partition function from ramda

Find comprehensive JavaScript ramda.partition code examples handpicked from public code repositorys.

51
52
53
54
55
56
57
58
59
60
    });

logger.info(`There were ${errors.length} errors when fetching hierarchies.`);
logger.debug({errors}, 'Errors: ');

const [notFound, hierarchies] = R.partition(x => x.hierarchy == null, results);

return {
    hierarchies,
    notFound: notFound.map(x => x.parentId),
fork icon65
star icon620
watch icon0

1
2
3
4
5
6
7
8
9
10
11
12
13


const isMiddleware = has('isMiddleware')


module.exports = (gathered, path) => {
  if (gathered) {
    const [middleware, transforms] = type(gathered) === 'Array' ? partition(isMiddleware, gathered) : [false, gathered]


    const padded = insertAll(1, transforms, [identity, identity])
    const newMiddlewares = middleware && intersperse(middleware, padded)
    const normalizedArray = flatten(newMiddlewares || padded)
fork icon2
star icon5
watch icon0

+ 2 other calls in file

7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
 * @example
 *
 *      R.partition(R.contains('s'), ['sss', 'ttt', 'foo', 'bars']);
 *      // => [ [ 'sss', 'bars' ],  [ 'ttt', 'foo' ] ]
 *
 *      R.partition(R.contains('s'), { a: 'sss', b: 'ttt', foo: 'bars' });
 *      // => [ { a: 'sss', foo: 'bars' }, { b: 'ttt' }  ]
 */
var partition = juxt([
    filter,
fork icon0
star icon0
watch icon0

+ 35 other calls in file

10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
* @return {Array} An array, containing first the subset of elements that satisfy the
*         predicate, and second the subset of elements that do not satisfy.
* @see R.filter, R.reject
* @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' }  ]
fork icon0
star icon0
watch icon2

+ 7 other calls in file

Other functions in ramda

Sorted by popularity

function icon

ramda.clone is the most popular function in ramda (30311 examples)