Skip to content

Instantly share code, notes, and snippets.

@themichaelyang
Last active February 10, 2019 03:23
Show Gist options
  • Save themichaelyang/b8e799f2f8aa0ad74ae0be73cc8e478c to your computer and use it in GitHub Desktop.
Save themichaelyang/b8e799f2f8aa0ad74ae0be73cc8e478c to your computer and use it in GitHub Desktop.
resolves even if rejected out
// https://stackoverflow.com/a/31424853/7971276
const reflect = p => p.then(v => ({v, status: "resolved" }),
e => ({e, status: "rejected" }));
reflect(promise).then((v => {
console.log(v.status);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment