Skip to content

Welshman Docs / @welshman/lib / partition

Function: partition() ​

partition<T>(f, xs): T[][]

Defined in: packages/lib/src/Tools.ts:739

Splits array into two arrays based on predicate

Type Parameters ​

• T

Parameters ​

f ​

(x) => boolean

Function to test elements

xs ​

T[]

Array to partition

Returns ​

T[][]

Tuple of [matching, non-matching] arrays