1 | # p-pipe
|
2 |
|
3 | > Compose promise-returning & async functions into a reusable pipeline
|
4 |
|
5 | ## Install
|
6 |
|
7 | ```
|
8 | $ npm install p-pipe
|
9 | ```
|
10 |
|
11 | ## Usage
|
12 |
|
13 | ```js
|
14 | import pPipe from 'p-pipe';
|
15 |
|
16 | const addUnicorn = async string => `${string} Unicorn`;
|
17 | const addRainbow = async string => `${string} Rainbow`;
|
18 |
|
19 | const pipeline = pPipe(addUnicorn, addRainbow);
|
20 |
|
21 | console.log(await pipeline('❤️'));
|
22 | //=> '❤️ Unicorn Rainbow'
|
23 | ```
|
24 |
|
25 | ## API
|
26 |
|
27 | ### pPipe(input…)
|
28 |
|
29 | The `input` functions are applied from left to right.
|
30 |
|
31 | #### input
|
32 |
|
33 | Type: `Function`
|
34 |
|
35 | Expected to return a `Promise` or any value.
|
36 |
|
37 | ## Related
|
38 |
|
39 | - [p-each-series](https://github.com/sindresorhus/p-each-series) - Iterate over promises serially
|
40 | - [p-series](https://github.com/sindresorhus/p-series) - Run promise-returning & async functions in series
|
41 | - [p-waterfall](https://github.com/sindresorhus/p-waterfall) - Run promise-returning & async functions in series, each passing its result to the next
|
42 | - [More…](https://github.com/sindresorhus/promise-fun)
|
43 |
|
44 | ---
|
45 |
|
46 | <div align="center">
|
47 | <b>
|
48 | <a href="https://tidelift.com/subscription/pkg/npm-p-pipe?utm_source=npm-p-pipe&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
49 | </b>
|
50 | <br>
|
51 | <sub>
|
52 | Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
53 | </sub>
|
54 | </div>
|