Travis build: 1467

This commit is contained in:
30secondsofcode
2018-01-28 12:55:37 +00:00
parent b005826fde
commit d1f222bc62
3 changed files with 39 additions and 3 deletions

View File

@ -82,6 +82,7 @@ average(1, 2, 3);
* [`collectInto`](#collectinto) * [`collectInto`](#collectinto)
* [`flip`](#flip) * [`flip`](#flip)
* [`over`](#over) * [`over`](#over)
* [`overArgs`](#overargs)
* [`pipeAsyncFunctions`](#pipeasyncfunctions) * [`pipeAsyncFunctions`](#pipeasyncfunctions)
* [`pipeFunctions`](#pipefunctions) * [`pipeFunctions`](#pipefunctions)
* [`promisify`](#promisify) * [`promisify`](#promisify)
@ -556,6 +557,34 @@ minMax(1, 2, 3, 4, 5); // [1,5]
<br>[⬆ Back to top](#table-of-contents) <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 ### pipeAsyncFunctions
Performs left-to-right function composition for asynchronous functions. Performs left-to-right function composition for asynchronous functions.

File diff suppressed because one or more lines are too long

View File

@ -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`. Use `Array.map()` to apply `transforms` to `args` in combination with the spread operator (`...`) to pass the transformed arguments to `fn`.
```js ```js
const overArgs = (fn, transforms) => (...args) => const overArgs = (fn, transforms) => (...args) => fn(...args.map((val, i) => transforms[i](val)));
fn(...args.map((val, i) => transforms[i](val)));
``` ```
```js ```js