You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

is-promise

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-promise

Test whether an object looks like a promises-a+ promise


Version published
Weekly downloads
8.1M
decreased by-19.35%
Maintainers
2
Install size
3.79 kB
Created
Weekly downloads
 

Package description

What is is-promise?

The is-promise npm package is a simple utility that checks if a given object is a promise. It is useful for ensuring that a value conforms to the Promise interface, which is essential in asynchronous programming.

What are is-promise's main functionalities?

Check if a value is a promise

This feature allows you to check if a given value is a promise. The function returns true if the value is a promise and false otherwise.

const isPromise = require('is-promise');

const promise = new Promise((resolve, reject) => {});
const notPromise = {};

console.log(isPromise(promise)); // true
console.log(isPromise(notPromise)); // false

Other packages similar to is-promise

Readme

Source

is-promise

Test whether an object looks like a promises-a+ promise

Build Status Dependency Status NPM version

Installation

$ npm install is-promise

You can also use it client side via npm.

API

import isPromise from 'is-promise';

isPromise(Promise.resolve());//=>true
isPromise({then:function () {...}});//=>true
isPromise(null);//=>false
isPromise({});//=>false
isPromise({then: true})//=>false

License

MIT

FAQs

Package last updated on 27 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc