UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

16 lines 624 B
/** * Returns elements from the array until predicate returns false. * @param array the array * @param fn the predicate * @signature * P.takeWhile(array, fn) * @signature * P.takeWhile(fn)(array) * @example * P.takeWhile([1, 2, 3, 4, 3, 2, 1], x => x !== 4) // => [1, 2, 3] * P.pipe([1, 2, 3, 4, 3, 2, 1], P.takeWhile(x => x !== 4)) // => [1, 2, 3] * @category Array, Pipe */ export declare function takeWhile<T>(array: readonly T[], fn: (item: T) => boolean): T[]; export declare function takeWhile<T>(fn: (item: T) => boolean): (array: readonly T[]) => T[]; //# sourceMappingURL=takeWhile.d.ts.map