Skip to content

magnetikonline/promessa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

About

Promise library for Node.js meeting the Promises/A+ specification, written with a focus towards readability.

Topics

Resources

License

Stars

Watchers

Forks