@unction/partition
v9.13.0
Published
Takes an iterable and splits into an array of two iterables based on a predicate.
Downloads
214
Readme
@unction/partition
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]]