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 619B

123456789101112131415161718192021222324
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var noop_1 = require("./noop");
  4. function pipe() {
  5. var fns = [];
  6. for (var _i = 0; _i < arguments.length; _i++) {
  7. fns[_i] = arguments[_i];
  8. }
  9. return pipeFromArray(fns);
  10. }
  11. exports.pipe = pipe;
  12. function pipeFromArray(fns) {
  13. if (!fns) {
  14. return noop_1.noop;
  15. }
  16. if (fns.length === 1) {
  17. return fns[0];
  18. }
  19. return function piped(input) {
  20. return fns.reduce(function (prev, fn) { return fn(prev); }, input);
  21. };
  22. }
  23. exports.pipeFromArray = pipeFromArray;
  24. //# sourceMappingURL=pipe.js.map