Function reduceWhile

  • 🦴 utilities

    reduce() with predicate for early termination. A simple version of the same function in the ramda package.

    Type Parameters

    • T
    • R

    Parameters

    • predicate: (acc: R, currentValue: T) => boolean
    • callbackfn: (previousValue: R, currentValue: T, currentIndex: number, array: T[]) => R
    • initialValue: R
    • array: T[]

    Returns R