# @blakek/is-promise

> ✅ check if a value is Promise-like

Latest version **1.0.0** (published 2020-09-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @blakek/is-promise
pnpm add @blakek/is-promise
yarn add @blakek/is-promise
bun add @blakek/is-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.0 |
| Published | 2020-09-24 |
| First published | 2020-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 98.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Blake Knight |
| Maintainers | blakek |
| Keywords | async, await, check, detect, is, kind, promise, promises, then-able, thenable, type |

## Links

- npm: https://www.npmjs.com/package/@blakek/is-promise
- Repository: https://github.com/blakek/is-promise
- Issues: https://github.com/blakek/is-promise/issues
- npm.io page: https://npm.io/package/@blakek/is-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.0 (latest) — 2020-09-24

## README

# @blakek/is-promise

> ✅ check if a value is Promise-like

Sometimes it makes sense to treat Promises and non-Promises differently. For
example, it can be helpful to only return a Promise if given a Promise. This
package helps with that.

If just checking to call `.then()`, you may be wanting to use the built-in
`Promise.resolve()`.

## Install

Using [Yarn]:

```bash
$ yarn add @blakek/is-promise
```

…or using [npm]:

```bash
$ npm i --save @blakek/is-promise
```

## Usage

```js
import { isPromise } from '@blakek/is-promise';

isPromise('test'); //» false

isPromise(Promise.resolve('test')); //» true

isPromise({ then: () => 'non-standard promise' }); //» true
```

## Contributing

[Node.js] and [Yarn] are required to work with this project.

To install all dependencies, run:

```bash
yarn
```

### Useful Commands

|                     |                                                 |
| ------------------- | ----------------------------------------------- |
| `yarn build`        | Builds the project to `./dist`                  |
| `yarn format`       | Format the source following the Prettier styles |
| `yarn test`         | Run project tests                               |
| `yarn test --watch` | Run project tests, watching for file changes    |

## License

MIT

[node.js]: https://nodejs.org/
[npm]: https://npmjs.com/
[yarn]: https://yarnpkg.com/en/docs/

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