Travis build: 1467
This commit is contained in:
29
README.md
29
README.md
@ -82,6 +82,7 @@ average(1, 2, 3);
|
||||
* [`collectInto`](#collectinto)
|
||||
* [`flip`](#flip)
|
||||
* [`over`](#over)
|
||||
* [`overArgs`](#overargs)
|
||||
* [`pipeAsyncFunctions`](#pipeasyncfunctions)
|
||||
* [`pipeFunctions`](#pipefunctions)
|
||||
* [`promisify`](#promisify)
|
||||
@ -556,6 +557,34 @@ minMax(1, 2, 3, 4, 5); // [1,5]
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### overArgs
|
||||
|
||||
Creates a function that invokes the provided function with its arguments transformed.
|
||||
|
||||
Use `Array.map()` to apply `transforms` to `args` in combination with the spread operator (`...`) to pass the transformed arguments to `fn`.
|
||||
|
||||
```js
|
||||
const overArgs = (fn, transforms) => (...args) => fn(...args.map((val, i) => transforms[i](val)));
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Examples</summary>
|
||||
|
||||
```js
|
||||
var func = overArgs(
|
||||
function(x, y) {
|
||||
return [x, y];
|
||||
},
|
||||
[square, doubled]
|
||||
);
|
||||
func(9, 3); // [81, 6]
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
<br>[⬆ Back to top](#table-of-contents)
|
||||
|
||||
|
||||
### pipeAsyncFunctions
|
||||
|
||||
Performs left-to-right function composition for asynchronous functions.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -5,8 +5,7 @@ Creates a function that invokes the provided function with its arguments transfo
|
||||
Use `Array.map()` to apply `transforms` to `args` in combination with the spread operator (`...`) to pass the transformed arguments to `fn`.
|
||||
|
||||
```js
|
||||
const overArgs = (fn, transforms) => (...args) =>
|
||||
fn(...args.map((val, i) => transforms[i](val)));
|
||||
const overArgs = (fn, transforms) => (...args) => fn(...args.map((val, i) => transforms[i](val)));
|
||||
```
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user