Skip to content

Instantly share code, notes, and snippets.

@EastSun5566
Created April 11, 2020 15:53
Show Gist options
  • Save EastSun5566/e4cb2e780f88d5ecfbfaeba9e9574678 to your computer and use it in GitHub Desktop.
Save EastSun5566/e4cb2e780f88d5ecfbfaeba9e9574678 to your computer and use it in GitHub Desktop.
Pipe function implement
const pipe = (...fns) => (param) => fns.reduce(
(res, fn) => (res.then && res.then(fn)) || fn(res),
param
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment