Home > @jsplumbtoolkit/browser-ui > partition
partition() function
Partitions a list into two lists - one for which the supplied partitioner returns true (the left
list), and the other, the right
list, for which the supplied partitioner does not return true.
Signature:
export declare function partition<T, A extends T, B extends T>(l: ArrayLike<T>, partitioner: (candidate: T) => boolean): {
left: Array<A>;
right: Array<B>;
};
Parameters
Parameter | Type | Description |
---|---|---|
l | ArrayLike<T> | List to partition |
partitioner | (candidate: T) => boolean | Function to use to partition the list. |
Returns:
{ left: Array<A>; right: Array<B>; }