Skip to content

Instantly share code, notes, and snippets.

@keyvan-m-sadeghi
Last active February 16, 2019 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keyvan-m-sadeghi/3f1f973bdb3f73d253e68a061db4819a to your computer and use it in GitHub Desktop.
Save keyvan-m-sadeghi/3f1f973bdb3f73d253e68a061db4819a to your computer and use it in GitHub Desktop.
let p = new Nancy((resolve, reject) => {
resolve(42);
reject(24); // ignored
resolve(); // ignored
});
p
.then(value => Nancy.reject(value)) // rejects
.catch(value => console.log(value)); // logs 42
p = Nancy.reject(Nancy.resolve(42));
// p.state is states.rejected
// p.value is a Nancy resolved to 42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment