Socket
Book a DemoInstallSign in
Socket

has-resolved

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

has-resolved

Checks if a Promise is resolved or rejected asynchronously

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
2
Created
Source

has-resolved

Checks if a Promise is resolved or rejected asynchronously

npm version

How to use

Resolution and rejection checks are asynchronous. You can use 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 be await-ed.

Check for rejection

import { hasRejected } from 'has-resolved';

const promise = Promise.reject();
const rejected = await hasRejected(promise);

expect(rejected).toBeTruthy();

Contributions

Like us? Star us.

Want to make it better? File us an issue.

Don't like something you see? Submit a pull request.

Keywords

promise

FAQs

Package last updated on 24 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts