Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/uncurry/docs/types/index.d"

Index

Type aliases

Functions

Type aliases

Closure

Closure: (...args: Array<any>) => any

Uncurried function.

param

arguments

throws

if arity is set, must provide expected number of input arguments

throws

configured arity must be compatible with curried function

throws

if arity is not set, number of arguments must be compatible with curried function

returns

function result

Type declaration

    • (...args: Array<any>): any
    • Parameters

      • Rest ...args: Array<any>

      Returns any

Functions

Export assignment uncurry

  • uncurry(fcn: Function, arity?: undefined | number, thisArg?: any): Closure
  • uncurry(fcn: Function, thisArg?: any): Closure
  • Transforms a curried function into a function invoked with multiple arguments.

    throws

    arity argument must be a positive integer

    Parameters

    • fcn: Function

      curried function

    • Optional arity: undefined | number

      number of parameters

    • Optional thisArg: any

      evaluation context

    Returns Closure

    uncurried function

    Example

    function addX( x ) {
        return function addY( y ) {
            return x + y;
        };
    }
    
    var add = uncurry( addX );
    
    var sum = add( 2, 3 );
    // returns 5
  • Transforms a curried function into a function invoked with multiple arguments.

    Parameters

    • fcn: Function

      curried function

    • Optional thisArg: any

      evaluation context

    Returns Closure

    uncurried function

    Example

    function addX( x ) {
        return function addY( y ) {
            return x + y;
        };
    }
    
    var add = uncurry( addX );
    
    var sum = add( 2, 3 );
    // returns 5