node/rxjs/dist/esm/internal/util/pipe.js
raw| 1 | import { identity } from './identity'; |
| 2 | export function pipe(...fns) { |
| 3 | return pipeFromArray(fns); |
| 4 | } |
| 5 | export function pipeFromArray(fns) { |
| 6 | if (fns.length === 0) { |
| 7 | return identity; |
| 8 | } |
| 9 | if (fns.length === 1) { |
| 10 | return fns[0]; |
| 11 | } |
| 12 | return function piped(input) { |
| 13 | return fns.reduce((prev, fn) => fn(prev), input); |
| 14 | }; |
| 15 | } |
| 16 | //# sourceMappingURL=pipe.js.map |