1.1.0 • Published 5 years ago
has-resolved v1.1.0
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
import hasResolved from 'has-resolved';
const promise = Promise.resolve();
const resolved = await hasResolved(promise);
expect(resolved).toBeTruthy();
Please note that
hasResolved
is an asynchronous function and need to beawait
-ed.
Check for rejection
import { hasRejected } from 'has-resolved';
const promise = Promise.reject();
const rejected = await hasRejected(promise);
expect(rejected).toBeTruthy();
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.
1.2.0
5 years ago
1.1.1-master.ac8eb71
5 years ago
1.2.1-master.9de2afd
5 years ago
1.1.1-master.4ab63e8
6 years ago
1.1.1-master.34be7bb
7 years ago
1.1.0
7 years ago
1.0.2-master.8863270
7 years ago
1.0.2-master.2565d02
7 years ago
1.0.2-0
7 years ago
1.0.2-master.41e1609
7 years ago
1.0.2-master.8ffd718
7 years ago
1.0.2-master.ef48d30
7 years ago
1.0.2-master.bef3a08
7 years ago
1.0.1
7 years ago
1.0.1-master.daa1ad9
7 years ago
1.0.0-master.caa8c5f
7 years ago
1.0.0
7 years ago
1.0.0-master.4e5cf2e
7 years ago