diff options
Diffstat (limited to 'node_modules/p-is-promise')
-rw-r--r-- | node_modules/p-is-promise/index.js | 10 | ||||
-rw-r--r-- | node_modules/p-is-promise/license | 21 | ||||
-rw-r--r-- | node_modules/p-is-promise/package.json | 43 | ||||
-rw-r--r-- | node_modules/p-is-promise/readme.md | 43 |
4 files changed, 117 insertions, 0 deletions
diff --git a/node_modules/p-is-promise/index.js b/node_modules/p-is-promise/index.js new file mode 100644 index 0000000..8f64f85 --- /dev/null +++ b/node_modules/p-is-promise/index.js @@ -0,0 +1,10 @@ +'use strict'; +module.exports = x => ( + x instanceof Promise || + ( + x !== null && + typeof x === 'object' && + typeof x.then === 'function' && + typeof x.catch === 'function' + ) +); diff --git a/node_modules/p-is-promise/license b/node_modules/p-is-promise/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/node_modules/p-is-promise/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/p-is-promise/package.json b/node_modules/p-is-promise/package.json new file mode 100644 index 0000000..45b9b44 --- /dev/null +++ b/node_modules/p-is-promise/package.json @@ -0,0 +1,43 @@ +{ + "name": "p-is-promise", + "version": "1.1.0", + "description": "Check if something is a promise", + "license": "MIT", + "repository": "sindresorhus/p-is-promise", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "keywords": [ + "promise", + "is", + "detect", + "check", + "kind", + "type", + "thenable", + "es2015", + "async", + "await", + "promises", + "bluebird" + ], + "devDependencies": { + "ava": "*", + "bluebird": "^3.4.6", + "xo": "*" + }, + "xo": { + "esnext": true + } +} diff --git a/node_modules/p-is-promise/readme.md b/node_modules/p-is-promise/readme.md new file mode 100644 index 0000000..15edbf2 --- /dev/null +++ b/node_modules/p-is-promise/readme.md @@ -0,0 +1,43 @@ +# p-is-promise [![Build Status](https://travis-ci.org/sindresorhus/p-is-promise.svg?branch=master)](https://travis-ci.org/sindresorhus/p-is-promise) + +> Check if something is a promise + +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. + +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 --save p-is-promise +``` + + +## Usage + +```js +const pIsPromise = require('p-is-promise'); +const Bluebird = require('bluebird'); + +pIsPromise(Promise.resolve('🦄')); +//=> true + +pIsPromise(Bluebird.resolve('🦄')); +//=> true + +pIsPromise('🦄'); +//=> false +``` + + +## Related + +- [More…](https://github.com/sindresorhus/promise-fun) + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) |