Last active
May 17, 2017 00:05
-
-
Save Bondifrench/2f968df5f58735dc78af52da704b8520 to your computer and use it in GitHub Desktop.
if you have a list of functions that return promises, that should be applied in sequence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Thanks @JAForbes | |
const chain = (p, f) => p.then(f) | |
const zero = Promise.resolve() | |
const series = xs => xs.reduce(chain, zero) | |
series([ getX, getY, getZ ]).then( z => ... ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment