partition
partition<
T>(iterable,predicate): [T[],T[]]
Defined in: group/partition.ts:12
Splits an iterable into two groups based on a predicate, in one pass.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T>
The input iterable.
predicate
Section titled “predicate”Predicate<[T]>
Returns true for items going into the first group.
Returns
Section titled “Returns”[T[], T[]]
A tuple [matching, nonMatching].