Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pipe.js 537B

123456789101112131415161718192021
  1. /** PURE_IMPORTS_START _noop PURE_IMPORTS_END */
  2. import { noop } from './noop';
  3. export function pipe() {
  4. var fns = [];
  5. for (var _i = 0; _i < arguments.length; _i++) {
  6. fns[_i] = arguments[_i];
  7. }
  8. return pipeFromArray(fns);
  9. }
  10. export function pipeFromArray(fns) {
  11. if (!fns) {
  12. return noop;
  13. }
  14. if (fns.length === 1) {
  15. return fns[0];
  16. }
  17. return function piped(input) {
  18. return fns.reduce(function (prev, fn) { return fn(prev); }, input);
  19. };
  20. }
  21. //# sourceMappingURL=pipe.js.map