p-is-promise
Check if something is a promise
Last updated 6 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm
$ cnpm install p-is-promise 
SYNC missed versions from official npm registry.

p-is-promise Build Status

Check if something is a promise

Why not is-promise? That module checks for a thenable, not an ES2015 promise. This one is stricter.

You most likely don't need this. Just pass your value to Promise.resolve() and let it handle it.

Can be useful if you need to create a fast path for a synchronous operation.

Install

$ npm install p-is-promise

Usage

const pIsPromise = require('p-is-promise');
const Bluebird = require('bluebird');

pIsPromise(Promise.resolve('????'));
//=> true

pIsPromise(Bluebird.resolve('????'));
//=> true

pIsPromise('????');
//=> false

Related

Current Tags

  • 3.0.0                                ...           latest (6 years ago)

3 Versions

  • 1.1.0                                ...           9 years ago
  • 3.0.0                                ...           6 years ago
  • 2.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (4)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org