# is-actual-promise

> Verify if something is a Promise

Latest version **1.0.2** (published 2024-05-14) · BlueOak-1.0.0 license · 0 weekly downloads

## Install

```sh
npm install is-actual-promise
pnpm add is-actual-promise
yarn add is-actual-promise
bun add is-actual-promise
```

## Health

**Score 30/100 (F)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2024-05-14 |
| First published | 2023-08-06 |
| Weekly downloads | 0 |
| License | BlueOak-1.0.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Isaac Z. Schlueter |
| Maintainers | isaacs |
| Keywords | is promise, is, type, check, isPromise |

## Links

- npm: https://www.npmjs.com/package/is-actual-promise
- Repository: https://github.com/isaacs/is-actual-promise
- Homepage: https://github.com/isaacs/is-actual-promise#readme
- Issues: https://github.com/isaacs/is-actual-promise/issues
- npm.io page: https://npm.io/package/is-actual-promise

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2024-05-14
- 1.0.1 — 2023-10-30
- 1.0.0 — 2023-08-06

## README

# is-actual-promise

Similar to [`p-is-promise`](https://npmjs.com/p-is-promise) and
[`is-promise`](https://npmjs.com/is-promise), which are also both
fine alternatives to this.

Differences (ie, "why this thing then?")

* This module is hybrid, so it can be used in either commonjs or
  esm. `is-promise` is hybrid, but `p-is-promise` is ESM-only.
* This module asserts that the tested value supplies the full
  actual `Promise` interface, not just `PromiseLike` (ie, it also
  asserts `.catch()` and `.finally()`. (`p-is-promise` tests for
  `.catch()`, neither tests for `.finally()`.)
* This module provides a named export rather than a default
  export, which is a bit less of a hassle in some scenarios.
* This module does not verify the resolution type of the Promise,
  since that cannot be determined or verified, only that it's a
  `Promise<any | void>`.

(Note that this module does _not_ verify that the `.catch()`,
`.then()`, and `.finally()` methods return Promises, because that
is impossible at run-time without actually calling them. No
duck-typing method should ever be considered fully
authoritative.)

## USAGE

```ts
import { isPromise } from 'is-actual-promise'

console.log(isPromise(new Promise(() => {}))) // true
console.log(isPromise((async () => true)())) // true
console.log(isPromise(Promise.resolve(true))) // true
console.log(isPromise({
  then: async () => 5,
  finally: async () => {},
  catch: () => {},
})) // true, but not accurate, limitation of duck typing
```

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