UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

16 lines 639 B
/** * Splits a given array at the first index where the given predicate returns true. * @param array the array to split * @param fn the predicate * @signature * P.splitWhen(array, fn) * @signature * P.splitWhen(fn)(array) * @example * P.splitWhen([1, 2, 3], x => x === 2) // => [[1], [2, 3]] * P.splitWhen(x => x === 2)([1, 2, 3]) // => [[1], [2, 3]] * @category Array, Pipe */ export declare function splitWhen<T>(array: readonly T[], fn: (item: T) => boolean): [T[], T[]]; export declare function splitWhen<T>(fn: (item: T) => boolean): (array: readonly T[]) => [T[], T[]]; //# sourceMappingURL=splitWhen.d.ts.map