@arrows/array
Version:
Functional tools for JS arrays
18 lines (17 loc) • 600 B
TypeScript
declare type TestFn<T> = (element: T, index: number, arr: T[]) => boolean;
declare type _Some = <T>(testFn: TestFn<T>, arr: T[]) => boolean;
declare type _Some2 = <T>(testFn: TestFn<T>) => (arr: T[]) => boolean;
declare type Some = _Some & _Some2;
/**
* Functional wrapper for Array.prototype.some
*
* Determines whether the specified test function
* returns true for any element of an array.
*
* @param testFn Test function
* @param arr Initial array
* @returns True if any element satisfies test function, false otherwise
*/
declare const some: Some;
export { some };
export default some;