# has-resolved

> Checks if a Promise is resolved or rejected asynchronously

Latest version **2.0.0** (published 2025-12-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install has-resolved
pnpm add has-resolved
yarn add has-resolved
bun add has-resolved
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2025-12-24 |
| First published | 2018-03-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 2 |
| Author | William Wong |
| Maintainers | compulim, spyip |
| Keywords | promise, resolve, resolved |

## Links

- npm: https://www.npmjs.com/package/has-resolved
- Repository: https://github.com/compulim/has-resolved
- Homepage: https://github.com/compulim/has-resolved#readme
- Issues: https://github.com/compulim/has-resolved/issues
- npm.io page: https://npm.io/package/has-resolved

## Dependencies (2)

- [@types/node](https://npm.io/package/@types/node.md) ^25.0.3
- [has-resolved](https://npm.io/package/has-resolved.md) ^2.0.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2025-12-24
- 2.0.1-main.202512310937.298889 (main) — 2025-12-31
- 1.2.1-master.9de2afd (master) — 2020-05-26
- 2.0.1-main.202512240943.fdd968b — 2025-12-24
- 1.2.1-main.202512240921.f311456 — 2025-12-24
- 1.2.1-main.202512240911.a293985 — 2025-12-24
- 1.2.1-main.202512240856.ea0eeaf — 2025-12-24
- 1.2.0 — 2020-05-26
- 1.1.1-master.ac8eb71 — 2020-05-26
- 1.1.1-master.4ab63e8 — 2019-07-18
- 1.1.1-master.34be7bb — 2018-10-09
- 1.1.0 — 2018-10-09
- 1.0.2-master.8863270 — 2018-07-19
- 1.0.2-master.2565d02 — 2018-05-19
- 1.0.2-0 — 2018-05-19
- … 9 more at https://npm.io/package/has-resolved/versions

## README

# has-resolved

Checks if a Promise is resolved or rejected asynchronously

[![npm version](https://badge.fury.io/js/has-resolved.svg)](https://badge.fury.io/js/has-resolved)

# How to use

Resolution and rejection checks are asynchronous. You can use `async`/`await` to simplify coding.

## Check for resolution

```js
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

```js
import { hasRejected } from 'has-resolved';

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

expect(rejected).toBeTruthy();
```

# Contributions

Like us? [Star](https://github.com/compulim/has-resolved/stargazers) us.

Want to make it better? [File](https://github.com/compulim/has-resolved/issues) us an issue.

Don't like something you see? [Submit](https://github.com/compulim/has-resolved/pulls) a pull request.

---
_Source: https://npm.io/package/has-resolved · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
