JSPM

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

Use either the native Promise or Micropromise (or another)

Package Exports

  • native-or-another

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 (native-or-another) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

native-or-another NPM version Build Status Coveralls

Use either the native Promise or Micropromise for now, may change in the future. If no implementation is found, an error will be thrown.
Idea from native-or-bluebird

Install Nodei.co stats

Install with npm

$ npm install native-or-another

Usage

var Promise = require('native-or-another');

The goal of this library is to be able to eventually remove this line from your code and use native Promises, allowing you to to write future-compatible code with ease. You should install micropromise in your libraries for maximum compatibility.

If you do not want an error to be thrown, require() the Promise implementation directly. If no implementation is found, undefined will be returned.

var Promise = require('native-or-another/promise');
if (Promise) // do stuff with promises

Tests

As usual - npm test or if you have mocha globally - mocha.

$ npm test

Authors & Contributors author tips

Charlike Mike Reagent

License MIT license

Copyright (c) 2014 Charlike Mike Reagent, contributors.
Released under the MIT license.