Pipe Functions

PHOTO EMBED

Sun Dec 26 2021 19:54:30 GMT+0000 (Coordinated Universal Time)

Saved by @Explosion #javascript #pipe #function

const pipe = (...ops) => {
  const _pipe = (a, b) => (arg) => b(a(arg));
  let bundle = ops.reduce((prevOp, nextOp) => {
    return _pipe(prevOp,nextOp);
  });
  return bundle;
}
content_copyCOPY

`pipe(a, b, c)(arguments) === c(b(a(arguments)))`

undefined