3 ms·
ES6 rest/spread operator is really nice for dealing with function arguments. function curry(fn) { return function accum(...args) { if(args.l
by serve_yay 11y ago
ES6 rest/spread operator is really nice for dealing with function arguments.
function curry(fn) {
return function accum(...args) {
if(args.length >= fn.length) {
return fn.apply(null, args)
}
return accum.bind(null, ...args)
}
}