Socket
Socket
Sign inDemoInstall

p-is-promise

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 3.0.0

29

index.d.ts

@@ -1,23 +0,16 @@

declare const pIsPromise: {
/**
Check if `input` is a ES2015 promise.
/**
Check if `value` is a ES2015 promise.
@param input - Value to be checked.
@param value - Value to be checked.
@example
```
import isPromise = require('p-is-promise');
@example
```
import isPromise = require('p-is-promise');
isPromise(Promise.resolve('🦄'));
//=> true
```
*/
(input: unknown): input is Promise<unknown>;
isPromise(Promise.resolve('🦄'));
//=> true
```
*/
declare function pIsPromise(value: unknown): value is Promise<unknown>;
// TODO: Remove this for the next major release, refactor the whole definition to:
// declare function pIsPromise(input: unknown): input is Promise<unknown>;
// export = pIsPromise;
default: typeof pIsPromise;
};
export = pIsPromise;
'use strict';
const isPromise = input => (
input instanceof Promise ||
const isObject = value => value !== null &&
(typeof value === 'object' || typeof value === 'function');
module.exports = value => (
value instanceof Promise ||
(
input !== null &&
typeof input === 'object' &&
typeof input.then === 'function' &&
typeof input.catch === 'function'
isObject(value) &&
typeof value.then === 'function' &&
typeof value.catch === 'function'
)
);
module.exports = isPromise;
// TODO: Remove this for the next major release
module.exports.default = isPromise;
{
"name": "p-is-promise",
"version": "2.1.0",
"version": "3.0.0",
"description": "Check if something is a promise",

@@ -13,3 +13,3 @@ "license": "MIT",

"engines": {
"node": ">=6"
"node": ">=8"
},

@@ -38,7 +38,12 @@ "scripts": {

"devDependencies": {
"ava": "^1.4.1",
"ava": "^2.1.0",
"bluebird": "^3.5.4",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"xo": {
"rules": {
"promise/prefer-await-to-then": "off"
}
}
}

@@ -39,6 +39,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)

- [More…](https://github.com/sindresorhus/promise-fun)
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc