Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Functions

Functions

Export assignment filterArguments

  • filterArguments(fcn: Function, predicate: Function, thisArg?: any): Function
  • Returns a function that applies arguments to a provided function according to a predicate function.

    Notes

    • The predicate function is provided the following arguments:

      • value: argument value.
      • index: argument index.
    • Only those arguments in which the predicate function returns a truthy value are applied to a provided function.

    Parameters

    • fcn: Function

      input function

    • predicate: Function

      predicate function

    • Optional thisArg: any

      input function context

    Returns Function

    function wrapper

    Example

    function foo( a, b ) {
        return [ a, b ];
    }
    
    function predicate( v ) {
        return ( v !== 2 );
    }
    
    var bar = filterArguments( foo, predicate );
    
    var out = bar( 1, 2, 3 );
    // returns [ 1, 3 ]