Function uncurry

  • Transforms a curried function into a function that accepts all its arguments at once. Works by iteratively applying arguments to the provided curried function.

    Type Parameters

    • T extends unknown[]
    • R

    Parameters

    • fn: ((...args: unknown[]) => unknown)

      The curried function to be transformed. Should accept a sequence of functions eventually producing a result.

        • (...args): unknown
        • Parameters

          • Rest...args: unknown[]

          Returns unknown

    Returns ((...args: T) => R)

    A function that takes all the arguments expected by the curried function at once and returns the final result.

      • (...args): R
      • Parameters

        • Rest...args: T

        Returns R