UNPKG

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).

24 lines (23 loc) 664 B
"use strict"; 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() { var funcs = []; for (var _i = 0; _i < arguments.length; _i++) { funcs[_i] = arguments[_i]; } return function inner(source) { var current = source; for (var _i = 0, funcs_1 = funcs; _i < funcs_1.length; _i++) { var func = funcs_1[_i]; current = func(current); } return current; }; } exports.pipe = pipe;