Skip to content

unctionjs/partition

Repository files navigation

@unction/partition

Tests Stability Dependencies

PredicateFunctionType => Array | Set | Record<string | number | symbol, B> | Map<B, A> | string => [Array | Set | Record<string | number | symbol, B> | Map<B, A> | string, Array | Set | Record<string | number | symbol, B> | Map<B, A> | string]

This function takes an enumerable and returns an Array of two enumerables. The first of which contains elements which satisfy the predicate, the second of which contains element which do not.

partition(isOdd)([1,2,3,4]) // [[1,3],[2,4]]