1 | export default function pPipe(...functions) {
|
2 | if (functions.length === 0) {
|
3 | throw new Error('Expected at least one argument');
|
4 | }
|
5 |
|
6 | return async input => {
|
7 | let currentValue = input;
|
8 |
|
9 | for (const function_ of functions) {
|
10 | currentValue = await function_(currentValue); // eslint-disable-line no-await-in-loop
|
11 | }
|
12 |
|
13 | return currentValue;
|
14 | };
|
15 | }
|