pipe-js
Version:
A backwards-compatible way of streamlining chained function calls in a readable and functional manner
24 lines (16 loc) • 1.12 kB
Markdown
# pipe-js
[](https://travis-ci.org/andrii-maglovanyi/pipe-js)
[](https://codecov.io/gh/andrii-maglovanyi/pipe-js)
[](https://www.npmjs.com/package/pipe-js)
[](https://npm-stat.com/charts.html?package=pipe-js&from=2017-07-15)
[](https://opensource.org/licenses/MIT)
A backwards-compatible way of streamlining chained function calls in a readable and functional manner
## Usage
```js
const pipe = require('pipe-js')
const hello = 'hello'
const capitalize = str => str[0].toUpperCase() + str.substring(1)
const duplicate = str => `${str}-${str}`
const exclaim = str => str + '!'
pipe(hello).through(duplicate, capitalize, [String.prototype.concat, ' world'], exclaim) // Hello-hello world!
```