Function flip

  • Creates a function that invokes func with arguments reversed.

    Type Parameters

    • F extends ((...args) => any)

    Parameters

    • func: F

      The function to flip arguments for.

    Returns ((...args) => ReturnType<F>)

    Returns the new flipped function.

      • (...args): ReturnType<F>
      • Parameters

        • Rest ...args: any[]
          Rest

        Returns ReturnType<F>

    Since

    5.12.0

    See

    [[reverse]]

    Example

    const flipped = flip((...args) => args)

    flipped('a', 'b', 'c', 'd')
    // => ['d', 'c', 'b', 'a']