Miss any of our Open RFC calls?Watch the recordings here! »

promessa

1.1.8 • Public • Published
Promises/A+ logo

Promessa

A Node.js Promises library which complies with the Promises/A+ specification. Written with a focus towards readability over high performance and used as a learning exercise to better understand how Promises function and evaluate themselves internally.

NPM

Usage

let Promessa = require('promessa');
 
let myPromise = new Promessa((resolve,reject) => {
 
    // implement here
});

Methods

Promessa implements the following constructor and prototype:

  • new Promessa(function(resolve,reject) { ... })
  • Promessa.prototype.then(onFulfilled,onRejected)
  • Promise.prototype.catch(onRejected)

In addition, the following utility methods are available:

  • Promessa.resolve(value)
  • Promessa.reject(reason)
  • Promessa.all(promiseList) (with promiseList as an Array)
  • Promessa.race(promiseList) (with promiseList as an Array)

For use of these methods, I won't repeat what is already available via the excellent MDN Promise documentation.

Tests

Library passes the promises-aplus-tests suite to meet the Promises/A+ specification. In addition a basic test suite for Promessa.all(promiseList) and Promessa.race(promiseList) methods is included.

All tests are run via test/run.sh.

Reference

Promise implementations/documentation referred to during development:

Install

npm i promessa

DownloadsWeekly Downloads

20

Version

1.1.8

License

MIT

Last publish

Collaborators

  • avatar