Function flip

  • Creates a function that invokes func with arguments reversed.

    Type Parameters

    • F extends (...args: any[]) => any

    Parameters

    • func: F

      The function to flip arguments for.

    Returns (...args: any[]) => ReturnType<F>

    Returns the new flipped function.

    5.12.0

    [[reverse]]

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

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