- reduceWhile<T, R>(predicate, callbackfn, initialValue, array): R
Parameters
- predicate: ((acc: R, currentValue: T) => boolean)
- (acc, currentValue): boolean
Returns boolean
- callbackfn: ((previousValue: R, currentValue: T, currentIndex: number, array: T[]) => R)
- (previousValue, currentValue, currentIndex, array): R
Parameters
- previousValue: R
- currentValue: T
- currentIndex: number
- array: T[]
Returns R
- initialValue: R
- array: T[]
Returns R
🦴 utilities
reduce()
with predicate for early termination. A simple version of the same function in theramda
package.