Skip to content

Instantly share code, notes, and snippets.

@rochapablo rochapablo/.js
Created Jul 26, 2018

Embed
What would you like to do?
Promise Tuple
(function() {
console.clear()
const a = () => {
return Promise.resolve({ value: 'a' })
}
const b = () => {
return Promise.resolve({ value: 'b' })
}
const c = () => {
return Promise.resolve({ value: 'c' })
}
const d = a()
.then((resa) => b()
.then((resb) => c()
.then((resc) => [resa, resb, resc])))
// .then(([resa, resb, resc]) => console.log(resa, resb, resc))
// .then(([resa, resb, resc]) => { return [resa, resb, resc] })
.then(([resa, resb, resc]) => [resa, resb, resc])
d.then((res) => console.log(res))
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.