Given is a Promises/A+ spec implementation wrote for fun and learning purposes, using ES6 syntax, taking as reference the blog post on here.
Use Given in the browser by adding the file Given.js, and use the constructor:
var g = given().resolve("Hello");
g.then(function(msg) {
console.log(msg);
});
Use in NodeJS by adding the file Given.js, and require it where needed:
const given = require('./Given');
var g = given().resolve("Hello");
g.then(function(msg) {
console.log(msg);
});
Given is a Promises/A+ compliant implementation, because it passed all tests in Promises/A+ Test Suite.
To run the tests:
- git-clone this repo
- Run
npm install
- Run
npm test
.
I must thank Kyle Simpson (@getify) for his feedback on the first version I published of this library. I have implemented most of his suggestions in the 1.0.1 version.