Skip to content

Instantly share code, notes, and snippets.

@kirpalmakanga
Last active July 18, 2019 20:04
Show Gist options
  • Save kirpalmakanga/871357fdb1dd6ecb5242e5916797cbde to your computer and use it in GitHub Desktop.
Save kirpalmakanga/871357fdb1dd6ecb5242e5916797cbde to your computer and use it in GitHub Desktop.
Async Compose & Pipe
const asyncCompose = (…functions) => input => functions.reduceRight((chain, func) => chain.then(func), Promise.resolve(input));
const asyncPipe = (…functions) => input => functions.reduce((chain, func) => chain.then(func), Promise.resolve(input));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment