Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

i-promise

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i-promise

Returns an available ES6 Promise implementation, browserify friendly.

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

i-promise

When calling this module a Promise library will be returned if one is available.

This module will not declare any dependencies, you should install a fallback library downstream if needed.

Install

npm install --save i-promise

Use

var Promise = require('i-promise');
if (!Promise) throw new Error('No ES6 Promise Library Available.');

return Promise.resolve('success')

Notes

In a browser (via browserify), it will return either window.Promise, window.Q.Promise or window.Q.promise in that order, you should have an es6-promise shim or the Q library loaded globally in the browser if you need promises in older browsers.

In node, attempts to use the following will be made.

Preferring user implementation over native

Default behavior is to always favor native implementation if found. You can still favor the implementation of your choice without overriding global Promise:

require('i-promise/config').use(MyPromiseImplementation);

You must run this code before any call to require('i-promise').

Keywords

FAQs

Package last updated on 10 Feb 2015

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc