es6-promise

Lightweight, spec-compliant Promise/A+ polyfill for pre-ES6 environments

Library
npm
v4.2.8
7,253stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
43/100Fair
Development Activity0
Maintenance0
Community72
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
67/100Good
Architecture65
Code Quality72
Innovation40
Learning Curve90

es6-promise is a tiny, standards-compliant implementation of the ES6 Promise specification, built on top of the RSVP.js promise library. It exists to give browsers and JavaScript runtimes that predate native Promise support (older browsers, some embedded/legacy environments) an identical, spec-conformant Promise global, so code written against the native Promise API works unmodified.

The package offers both a Promise export for manual use and an es6-promise/auto entry point that polyfills the global Promise automatically if it’s missing. It passes the full Promises/A+ conformance test suite and was historically bundled by major frameworks (including early Ember.js and Vue CLI targets) as their default Promise polyfill before native support became universal.

What You Get

  • A Promise constructor matching the ES6 specification, built on the battle-tested RSVP.js implementation
  • An es6-promise/auto module that polyfills window.Promise/global.Promise automatically when missing
  • Full Promises/A+ test-suite conformance
  • Prebuilt UMD, CommonJS, and minified browser bundles for direct <script> inclusion
  • TypeScript type definitions (es6-promise.d.ts)

Common Use Cases

  • Polyfilling Promise support for legacy browser targets (older IE, older mobile browsers)
  • Ensuring consistent Promise behavior across environments with partial or non-standard native implementations
  • Being bundled as a dependency by other libraries/frameworks that need to guarantee Promise availability
  • Providing a reliable Promise implementation in constrained or embedded JavaScript runtimes

Under The Hood

Architecture - The implementation is a self-contained module under lib/es6-promise/: promise.js defines the public Promise class, delegating resolution/rejection scheduling to -internal.js and enumerator.js (which implements Promise.all/Promise.race semantics), while asap.js implements the microtask scheduler used to defer callback execution to match spec-mandated async timing. polyfill.js is a thin wrapper that only assigns the implementation to the global scope if a conformant native Promise isn’t already present, and es6-promise.auto.js re-exports the library with the polyfill applied eagerly on import.

Tech Stack - Plain ES5-targeted JavaScript (transpiled from newer syntax via Babel 6 plugins) built with Broccoli as the build pipeline, producing UMD/CJS/minified browser bundles. Tests run via Testem across multiple browser/Node targets, driven by the standard promises-aplus-tests conformance suite plus custom scheduler and extension tests.

Code Quality - The library is validated against the official Promises/A+ compliance test suite (test/test-adapter.js), which is the strongest correctness signal a Promise implementation can have, plus additional scheduler-specific and extension-behavior tests. The codebase is small, stable, and hasn’t needed structural changes in years since the ES6 Promise spec it implements is itself frozen.

API Design - The API is intentionally identical to native Promise, so there is zero learning curve for anyone who knows JavaScript Promises — new Promise((resolve, reject) => {}), .then(), .catch(), Promise.all(), and Promise.race() all behave exactly as spec’d. The only decision a consumer makes is require('es6-promise') (manual, opt-in polyfilling) vs. require('es6-promise/auto') (immediate global polyfill).

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search