lie

A minimal and fast promise implementation

npm install lie
273 downloads in the last day
2 342 downloads in the last week
10 375 downloads in the last month

lie

Promises/A+ logo

lie a small, performant, promise library implementing the Promises/A+ spec Version 1.1.

A originally a fork of Ruben Verborgh's library called promiscuous, version 2.6 and above are forked from ayepromise by Chris Burgmer.

API

by default adds a function called 'Promise' to the global scope (or if you grab the noConflict version than one called Lie)

return a promise

new Promise(function(resolve, reject){
    doSomething(function(err, result) {
        if (err) {
            reject(err);
        } else {
            resolve(result);
        }
    });
}).then(function (value) {
    //on success
}, function (reason) {
    //on error
}).catch(function (reason) {
    //short cut for error handling
});

Promise.all([
    //array of promises or values
]).then(function ([/* array of results */]));

node

install with npm install lie, exactly the same as above but

var promise = require('lie');
npm loves you