JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 21881897
  • Score
    100M100P100Q220886F
  • License MIT

Resolve any installed ES6 compatible promise

Package Exports

  • any-promise

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (any-promise) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Any Promise

Build Status

Let your library support any ES6 compatible Promise library or polyfill and leave the choice to the end user. The end user can install a polyfill or npm install their preference before using this library and the installed library will be automatically detected.

Prefers a global Promise object (native or polyfill). If one is not detected, attempts to load libraries in the following order. The first successful require will be exported.

If you have multiple libraries installed (e.g. for testing), and would like to specify one you can use the PROMISE_IMPL env variable.

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);
  }
});