Update snippet descriptions
This commit is contained in:
@ -5,7 +5,8 @@ tags: function,intermediate
|
||||
|
||||
Creates a function that invokes the provided function with its arguments arranged according to the specified indexes.
|
||||
|
||||
- Use `Array.prototype.map()` to reorder arguments based on `indexes` in combination with the spread operator (`...`) to pass the transformed arguments to `fn`.
|
||||
- Use `Array.prototype.map()` to reorder arguments based on `indexes`.
|
||||
- Use the spread operator (`...`) to pass the transformed arguments to `fn`.
|
||||
|
||||
```js
|
||||
const rearg = (fn, indexes) => (...args) => fn(...indexes.map(i => args[i]));
|
||||
|
||||
Reference in New Issue
Block a user