Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/function-sequence/docs/types/index.d"

Index

Functions

Functions

Export assignment funseq

  • funseq(...fcn: Array<Function>): Function
  • Returns a pipeline function.

    Notes

    • Starting from the left, the pipeline function evaluates each function and passes the result as an argument to the next function. The result of the rightmost function is the result of the whole.
    • Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as unary functions.
    throws

    must provide more than one argument

    Parameters

    • Rest ...fcn: Array<Function>

      functions to evaluate in sequential order

    Returns Function

    pipeline function

    Example

    function a( x ) {
        return 2 * x;
    }
    
    function b( x ) {
        return x + 3;
    }
    
    function c( x ) {
        return x / 5;
    }
    
    var f = funseq( a, b, c );
    
    var z = f( 6 );
    // returns 3