Code styling
This commit is contained in:
@ -5,7 +5,7 @@ Creates a function that invokes the provided function with its arguments arrange
|
|||||||
Use `Array.map()` to reorder arguments based on `indexes` in combination with the spread operator (`...`) to pass the transformed arguments to `fn`.
|
Use `Array.map()` to reorder arguments based on `indexes` in combination with the spread operator (`...`) to pass the transformed arguments to `fn`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const rearg = (fn, indexes) => (...args) => fn(...indexes.map(idx => args[idx]));
|
const rearg = (fn, indexes) => (...args) => fn(...indexes.map(i => args[i]));
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
const rearg = (fn, indexes) => (...args) => fn(...indexes.map(idx => args[idx]));
|
const rearg = (fn, indexes) => (...args) => fn(...indexes.map(i => args[i]));
|
||||||
module.exports = rearg;
|
module.exports = rearg;
|
||||||
|
|||||||
Reference in New Issue
Block a user