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

any-promise

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

any-promise - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

any-promise-shim.js

56

any-promise.js
"use strict";
/* global Symbol */
var PROMISE_EXISTS = typeof Promise !== 'undefined',
PROMISE_IMPL,
PROMISE_IMPL = process.env.PROMISE_IMPL,
undef;

@@ -11,33 +10,26 @@

module.exports = (function(){
function load(){
var libs;
if(PROMISE_IMPL === undef && typeof process !== 'undefined' && process.env){
PROMISE_IMPL = process.env.PROMISE_IMPL;
}
if(PROMISE_IMPL !== undef){
libs = [process.env.PROMISE_IMPL];
} else {
libs = [
"es6-promise",
"promise",
"native-promise-only",
"bluebird",
"rsvp",
"when",
"q"];
}
var i = 0, len = libs.length, lib;
for(; i < len; i++){
try {
lib = require(libs[i]);
if(lib.Promise !== undef){
return lib.Promise;
}
return lib;
} catch(e){}
}
throw new Error('Must install one of: '+libs.join());
var libs;
if(PROMISE_IMPL !== undef){
libs = [process.env.PROMISE_IMPL];
} else {
libs = [
"es6-promise",
"promise",
"native-promise-only",
"bluebird",
"rsvp",
"when",
"q"];
}
return load();
var i = 0, len = libs.length, lib;
for(; i < len; i++){
try {
lib = require(libs[i]);
if(lib.Promise !== undef){
return lib.Promise;
}
return lib;
} catch(e){}
}
throw new Error('Must install one of: '+libs.join());
})();

@@ -44,0 +36,0 @@ }

{
"name": "any-promise",
"version": "0.0.1",
"version": "0.0.2",
"description": "Resolve any installed ES6 compatible promise",
"main": "any-promise.js",
"browser": "any-promise-shim.js",
"scripts": {

@@ -7,0 +8,0 @@ "test": "make test"

@@ -18,1 +18,19 @@ ## Any Promise

If you have multiple libraries installed (e.g. for testing), and would like to specify one you can use the `PROMISE_IMPL` env variable.
```javascript
var Promise = require('any-promise');
return Promise
.all([xf, f, init, coll])
.then(fn);
return new Promise(function(resolve, reject){
try {
resolve(item);
} catch(e){
reject(e);
}
});
```
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