UNPKG

343 BJavaScriptView Raw
1'use strict';
2
3module.exports = (...functions) => {
4 if (functions.length === 0) {
5 throw new Error('Expected at least one argument');
6 }
7
8 return async input => {
9 let currentValue = input;
10
11 for (const fn of functions) {
12 currentValue = await fn(currentValue); // eslint-disable-line no-await-in-loop
13 }
14
15 return currentValue;
16 };
17};