Skip to content

Commit

Permalink
Travis build: 1360
Browse files Browse the repository at this point in the history
  • Loading branch information
Chalarangelo committed Jan 23, 2018
1 parent 920841a commit c4a7851
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ average(1, 2, 3);

* [`chainAsync`](#chainasync)
* [`compose`](#compose)
* [`composeRight`](#composeright)
* [`curry`](#curry)
* [`defer`](#defer)
* [`functionName`](#functionname)
Expand Down Expand Up @@ -2845,6 +2846,32 @@ multiplyAndAdd5(5, 2); // 15
<br>[⬆ Back to top](#table-of-contents)


### composeRight

Performs left-to-right function composition.

Use `Array.reduce()` to perform left-to-right function composition.
The first (leftmost) function can accept one or more arguments; the remaining functions must be unary.

```js
const composeRight = (...fns) => fns.reduce((f, g) => (...args) => g(f(...args)));
```

<details>
<summary>Examples</summary>

```js
const add = (x, y) => x + y;
const square = x => x * x;
const addAndSquare = composeRight(add, square);
addAndSquare(1, 2); // 9
```

</details>

<br>[⬆ Back to top](#table-of-contents)


### curry

Curries a function.
Expand Down
Loading

0 comments on commit c4a7851

Please sign in to comment.