has-resolved
Checks if a Promise is resolved or rejected asynchronously
How to use
Resolution and rejection checks are asynchronous. You can use ES6 async
/await
to simplify coding.
Check for resolution
; const promise = Promise;const resolved = await ; ;
Please note that
hasResolved
is an asynchronous function and need to beawait
-ed.
Check for rejection
; const promise = Promise;const rejected = await ; ;
hasRejected
is not a default export, thus, the bracelets is needed for named import.
Contributions
Like us? Star us.
Want to make it better? File us an issue.
Don't like something you see? Submit a pull request.