Front end of the Slack clone application.

pipe.js 418B

123456789101112131415161718
  1. import { noop } from './noop';
  2. /* tslint:enable:max-line-length */
  3. export function pipe(...fns) {
  4. return pipeFromArray(fns);
  5. }
  6. /* @internal */
  7. export function pipeFromArray(fns) {
  8. if (!fns) {
  9. return noop;
  10. }
  11. if (fns.length === 1) {
  12. return fns[0];
  13. }
  14. return function piped(input) {
  15. return fns.reduce((prev, fn) => fn(prev), input);
  16. };
  17. }
  18. //# sourceMappingURL=pipe.js.map