Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/curry-right/docs/types/index.d"

Index

Type aliases

Functions

Type aliases

Closure

Closure: (v: any) => any

Curry function.

param

curried function parameter

returns

partially applied curry function or curried function result

Type declaration

    • (v: any): any
    • Parameters

      • v: any

      Returns any

Functions

Export assignment curryRight

  • curryRight(fcn: Function, arity?: undefined | number, thisArg?: any): Closure
  • curryRight(fcn: Function, thisArg?: any): Closure
  • Transforms a function into a sequence of functions each accepting a single argument.

    Notes

    • Until return value resolution, each invocation returns a new partially applied curry function.
    • This function applies arguments starting from the right.
    throws

    arity must be a positive integer

    Parameters

    • fcn: Function

      function to curry

    • Optional arity: undefined | number

      number of parameters

    • Optional thisArg: any

      evaluation context

    Returns Closure

    curry function

    Example

    function add( x, y ) {
        return x + y;
    }
    
    var f = curryRight( add );
    
    var sum = f( 2 )( 3 );
    // returns 5
  • Transforms a function into a sequence of functions each accepting a single argument.

    Notes

    • Until return value resolution, each invocation returns a new partially applied curry function.
    • This function applies arguments starting from the right.

    Parameters

    • fcn: Function

      function to curry

    • Optional thisArg: any

      evaluation context

    Returns Closure

    curry function

    Example

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