Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/reorder-arguments/docs/types/index.d"

Index

Functions

Functions

Export assignment reorderArguments

  • reorderArguments(fcn: Function, indices: Array<number>, thisArg?: any): Function
  • Returns a function that invokes a provided function with reordered arguments.

    throws

    second argument must be an array of nonnegative integers

    Parameters

    • fcn: Function

      input function

    • indices: Array<number>

      argument indices

    • Optional thisArg: any

      function context

    Returns Function

    function with reordered arguments

    Example

    function foo( a, b, c ) {
        return [ a, b, c ];
    }
    
    var bar = reorderArguments( foo, [ 2, 0, 1 ] );
    
    var out = bar( 1, 2, 3 );
    // returns [ 3, 1, 2 ]