reduce: Require initialValue
in functional interface.
This commit is contained in:
parent
366249f84f
commit
1fc2308f08
2 changed files with 8 additions and 1 deletions
|
@ -407,9 +407,14 @@ const methods = Object.keys(channel).filter(
|
|||
method => typeof channel[method] === `function`
|
||||
);
|
||||
|
||||
const arities = {
|
||||
reduce: 2,
|
||||
slice: 2
|
||||
};
|
||||
|
||||
methods.forEach(method => {
|
||||
const bound = function(...args) {
|
||||
const arity = method === `slice` ? 2 : channel[method].length;
|
||||
const arity = arities[method] || channel[method].length;
|
||||
|
||||
return args.length > arity
|
||||
? args[arity][method](...args.slice(0, arity))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue