Function partition

Partitions an array into two arrays based on a given predicate function.

const isEven = (n: number) => n % 2 === 0;
const numbers = [1, 2, 3, 4, 5];
const [evens, odds] = partition(isEven)(numbers);
// evens: number[] = [2, 4]
// odds: number[] = [1, 3, 5]