Get rid of arguments for bind
This commit is contained in:
@ -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.
|
Use `Array.concat()` to prepend any additional supplied parameters to the arguments.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const bind = (fn, context, ...args) =>
|
const bind = (fn, context, ...boundArgs) => (...args) => fn.apply(context, [...boundArgs, ...args]);
|
||||||
function() {
|
|
||||||
return fn.apply(context, args.concat(...arguments));
|
|
||||||
};
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@ -1,5 +1,2 @@
|
|||||||
const bind = (fn, context, ...args) =>
|
const bind = (fn, context, ...boundArgs) => (...args) => fn.apply(context, [...boundArgs, ...args]);
|
||||||
function() {
|
|
||||||
return fn.apply(context, args.concat(...arguments));
|
|
||||||
};
|
|
||||||
module.exports = bind;
|
module.exports = bind;
|
||||||
|
|||||||
Reference in New Issue
Block a user