Function reduceRightWithIndex

  • Example

    import * as A from "flurp/array";

    const concatEveryOther = A.reduceRightWithIndex(
    (acc: string, next: string, index: number) =>
    acc + (N.isEven(index) ? next : ""),
    "every other from right: "
    );
    f(["a", "b", "c", "d", "e"]); // "every other from right: eca"

    Type Parameters

    • T

    • U

    Parameters

    • accumulator: ((acc: T, next: U, index: number) => T)
        • (acc: T, next: U, index: number): T
        • Parameters

          • acc: T
          • next: U
          • index: number

          Returns T

    • initial: T

    Returns ((arr: readonly U[]) => T)

      • (arr: readonly U[]): T
      • Parameters

        • arr: readonly U[]

        Returns T