repl.txt (1193B)
1 2 {{alias}}( fcn[, arity, ][thisArg] ) 3 Transforms a curried function into a function invoked with multiple 4 arguments. 5 6 Parameters 7 ---------- 8 fcn: Function 9 Curried function. 10 11 arity: integer (optional) 12 Number of parameters. 13 14 thisArg: any (optional) 15 Evaluation context. 16 17 Returns 18 ------- 19 out: Function 20 Uncurried function. 21 22 Examples 23 -------- 24 > function addX( x ) { 25 ... return function addY( y ) { 26 ... return x + y; 27 ... }; 28 ... }; 29 > var fcn = {{alias}}( addX ); 30 > var sum = fcn( 2, 3 ) 31 5 32 33 // To enforce a fixed number of parameters, provide an `arity` argument: 34 > function add( x ) { 35 ... return function add( y ) { 36 ... return x + y; 37 ... }; 38 ... }; 39 > fcn = {{alias}}( add, 2 ); 40 > sum = fcn( 9 ) 41 <Error> 42 43 // To specify an execution context, provide a `thisArg` argument: 44 > function addX( x ) { 45 ... this.x = x; 46 ... return addY; 47 ... }; 48 > function addY( y ) { 49 ... return this.x + y; 50 ... }; 51 > fcn = {{alias}}( addX, {} ); 52 > sum = fcn( 2, 3 ) 53 5 54 55 See Also 56 -------- 57