axax
Version:
A library of async iterator extensions for JavaScript including ```map```, ```reduce```, ```filter```, ```flatMap```, ```pipe``` and [more](https://github.com/jamiemccrindle/axax/blob/master/docs/API.md#functions).
19 lines (18 loc) • 488 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Pipes an async iterator through a list of functions that take an async iterator
* as an argument.
*
* @param funcs a series of functions that operate on AsyncIterables
*/
function pipe(...funcs) {
return function inner(source) {
let current = source;
for (const func of funcs) {
current = func(current);
}
return current;
};
}
exports.pipe = pipe;