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

12345678910111213141516
  1. import { noop } from './noop';
  2. export function pipe(...fns) {
  3. return pipeFromArray(fns);
  4. }
  5. export function pipeFromArray(fns) {
  6. if (!fns) {
  7. return noop;
  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