You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 973B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # p-is-promise [![Build Status](https://travis-ci.org/sindresorhus/p-is-promise.svg?branch=master)](https://travis-ci.org/sindresorhus/p-is-promise)
  2. > Check if something is a promise
  3. Why not [`is-promise`](https://github.com/then/is-promise)? That module [checks for a thenable](https://github.com/then/is-promise/issues/6), not an ES2015 promise. This one is stricter.
  4. You most likely don't need this. Just pass your value to `Promise.resolve()` and let it handle it.
  5. Can be useful if you need to create a fast path for a synchronous operation.
  6. ## Install
  7. ```
  8. $ npm install --save p-is-promise
  9. ```
  10. ## Usage
  11. ```js
  12. const pIsPromise = require('p-is-promise');
  13. const Bluebird = require('bluebird');
  14. pIsPromise(Promise.resolve('🦄'));
  15. //=> true
  16. pIsPromise(Bluebird.resolve('🦄'));
  17. //=> true
  18. pIsPromise('🦄');
  19. //=> false
  20. ```
  21. ## Related
  22. - [More…](https://github.com/sindresorhus/promise-fun)
  23. ## License
  24. MIT © [Sindre Sorhus](https://sindresorhus.com)