tamda
Version:
Practical functional programming library for TypeScript
20 lines (19 loc) • 890 B
TypeScript
import { Predicate } from '../operators';
/**
* Takes items from the start of an `array` while a predicate `whileFn` is true.
* @param array Array to take items from.
* @param whileFn A function that determines when to stop taking, return true to continue or false to stop.
*/
export declare function takeWhile<T>(array: T[], whileFn: Predicate<T>): T[];
/**
* Returns a function that
* takes items from the start of an `array` while a predicate `whileFn` is true.
* @param whileFn A function that determines when to stop taking, return true to continue or false to stop.
*/
export declare function takeWhile<T>(whileFn: Predicate<T>): typeof deferred;
/**
* Takes items from the start of an `array` while a previously specified predicate `whileFn` is true.
* @param array Array to take items from.
*/
declare function deferred<T>(array: T[]): T[];
export {};