UNPKG

tamda

Version:

Practical functional programming library for TypeScript

22 lines (21 loc) 881 B
import { Predicate } from '../operators'; /** * Splits an `array` in two, according to `predicate`. * @param array Array to split. * @param predicate Function that determines in which half to put each item. * @returns Tuple like `[[match the predicate], [do not match the predicate]]`. */ export declare function split<T>(array: T[], predicate: Predicate<T>): [T[], T[]]; /** * Returns a function that * splits an `array` in two, according to `predicate`. * @param predicate Function that determines in which half to put each item. */ export declare function split<T>(predicate: Predicate<T>): typeof deferred; /** * Splits an `array` in two, according to `predicate`. * @param array Array to split. * @returns Tuple like `[[match the predicate], [do not match the predicate]]`. */ declare function deferred<T>(array: T[]): [T[], T[]]; export {};