Merge pull request #706 from Siarhei-Zharnasek/master

Get rid of arguments for bind
This commit is contained in:
Angelos Chalaris
2018-08-10 09:31:56 +03:00
committed by GitHub
2 changed files with 2 additions and 8 deletions

View File

@ -6,10 +6,7 @@ Return a `function` that uses `Function.apply()` to apply the given `context` to
Use `Array.concat()` to prepend any additional supplied parameters to the arguments.
```js
const bind = (fn, context, ...args) =>
function() {
return fn.apply(context, args.concat(...arguments));
};
const bind = (fn, context, ...boundArgs) => (...args) => fn.apply(context, [...boundArgs, ...args]);
```
```js

View File

@ -1,5 +1,2 @@
const bind = (fn, context, ...args) =>
function() {
return fn.apply(context, args.concat(...arguments));
};
const bind = (fn, context, ...boundArgs) => (...args) => fn.apply(context, [...boundArgs, ...args]);
module.exports = bind;