tree-thunk
v0.0.3
Published
将多参数函数转成单参数函数
Downloads
2
Readme
TreeThunk
将多参数函数转成单参数函数
这个我也不知道怎么表述好
var TreeThunk = require('./TreeThunk');
var calc = (a, b, c, d, e, f) => {
return a + b + c + d - e - f;
}
var thunkCalc0 = TreeThunk(calc, 3);
console.log(thunkCalc0(1, 2)(3, 4)(5, 6));
var thunkCalc1 = TreeThunk(calc, 5);
console.log(thunkCalc1(1, 2)(3)(4)(5)(6));
var thunkCalc2 = TreeThunk(calc, 6);
console.log(thunkCalc2(1)(2)(3)(4)(5)(6));