Skip to content

Instantly share code, notes, and snippets.

@bwinant
Last active August 17, 2018 01:10
Show Gist options
  • Save bwinant/539ec817f153e6f8843802a13fcf5146 to your computer and use it in GitHub Desktop.
Save bwinant/539ec817f153e6f8843802a13fcf5146 to your computer and use it in GitHub Desktop.
Execute promises sequentially
const resolveSequential = (funcs) => {
return funcs.reduce(
(promise, f) => {
return promise.then(all => {
return f().then(r => {
all.push(r);
return all;
})
})
},
Promise.resolve([])
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment