Options
All
  • Public
  • Public/Protected
  • All
Menu

Module rearg

Index

Functions Function

Function Functions

  • default(func: Function, indexes: number[]): any
  • default(func: Function, ...indexes: number[]): any
  • Creates a function that invokes func with arguments arranged according to the specified indexes where the argument value at the first index is provided as the first argument, the argument value at the second index is provided as the second argument, and so on.

    since

    5.5.0

    example
    var rearged = rearg(function(a, b, c) {
    return [a, b, c];
    }, [2, 0, 1]);

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

    Parameters

    • func: Function

      The function to rearrange arguments for.

    • indexes: number[]

      The arranged argument indexes.

    Returns any

    Returns the new function.

  • Parameters

    • func: Function
    • Rest ...indexes: number[]

    Returns any