Options
All
  • Public
  • Public/Protected
  • All
Menu

Module function/flip

Index

References

Functions

References

Renames and re-exports flip

Functions

  • flip<T, U, R>(fn: (arg0: T, arg1: U, ...args: any[]) => R): (arg1: U, arg0: T, ...args: any[]) => R
  • Returns a new function much like the supplied one, except that the first two arguments' order is reversed.

    example
     const neg = (a, b) => a - b

    flip(neg)(3, 5); //=> 2

    Type parameters

    • T

    • U

    • R

    Parameters

    • fn: (arg0: T, arg1: U, ...args: any[]) => R

      The function to invoke with its first two parameters reversed.

        • (arg0: T, arg1: U, ...args: any[]): R
        • Parameters

          • arg0: T
          • arg1: U
          • Rest ...args: any[]

          Returns R

    Returns (arg1: U, arg0: T, ...args: any[]) => R

    The result of invoking fn with its first two parameters' order reversed.

      • (arg1: U, arg0: T, ...args: any[]): R
      • Parameters

        • arg1: U
        • arg0: T
        • Rest ...args: any[]

        Returns R

Generated using TypeDoc