Update bindKey.md

This commit is contained in:
Angelos Chalaris
2018-08-10 10:47:56 +03:00
committed by GitHub
parent c3015e47fc
commit c03ff71088

View File

@ -3,7 +3,7 @@
Creates a function that invokes the method at a given key of an object, optionally adding any additional supplied parameters to the beginning of the arguments.
Return a `function` that uses `Function.apply()` to bind `context[fn]` to `context`.
Use spread operator to prepend any additional supplied parameters to the arguments.
Use the spread operator (`...`) to prepend any additional supplied parameters to the arguments.
```js
const bindKey = (context, fn, ...boundArgs) => (...args) => context[fn].apply(context, [...boundArgs, ...args]);