@arrows/array
Version:
Functional tools for JS arrays
17 lines (16 loc) • 616 B
TypeScript
declare type SideEffectFn<T> = (currentValue?: T, index?: number, array?: T[]) => unknown;
declare type _ForEach = <T>(sideEffectFn: SideEffectFn<T>, arr: T[]) => void;
declare type _ForEach2 = <T>(sideEffectFn: SideEffectFn<T>) => (arr: T[]) => void;
declare type ForEach = _ForEach & _ForEach2;
/**
* Functional wrapper for Array.prototype.forEach
*
* Performs the specified side effect action for each element in an array.
*
* @param sideEffectFn Side effect function
* @param arr Initial array
* @returns Nothing (undefined)
*/
declare const forEach: ForEach;
export { forEach };
export default forEach;