Functional API: Fix off-by-one bug.
This commit is contained in:
parent
10f06d08fd
commit
1b1192c0e7
2 changed files with 7 additions and 3 deletions
|
@ -361,10 +361,10 @@ const methods = Object.keys(channel).concat(Object.keys(channel.readOnly()));
|
|||
|
||||
methods.forEach(method => {
|
||||
const bound = function(...args) {
|
||||
const arity = method === `slice` ? 3 : channel[method].length;
|
||||
const arity = method === `slice` ? 2 : channel[method].length;
|
||||
|
||||
return args.length >= arity
|
||||
? args[arity - 1][method](...args.slice(0, arity - 1))
|
||||
return args.length > arity
|
||||
? args[arity][method](...args.slice(0, arity))
|
||||
: bound.bind(this, ...args);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue