Skip to content

Instantly share code, notes, and snippets.

@nsacerdote
Created October 2, 2020 12:43
Show Gist options
  • Save nsacerdote/3adf44697cd3eaad78334a68ea181a9f to your computer and use it in GitHub Desktop.
Save nsacerdote/3adf44697cd3eaad78334a68ea181a9f to your computer and use it in GitHub Desktop.
function doSomething(input) {
if (!input) {
return Promise.reject('missing input'); // returns a rejected promise
} else {
return Promise.resolve(input + ' done'); // returns a fulfilled promise
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment