lib/Revenant.js
function promiseOrCallback (callback, executor) {
    var promise = new Promise(executor);

    // no callback: do not attach
    if (typeof callback !== 'function') {
        return promise;
    }

    return promise.then(function (value) {
        setImmediate(function () {
            callback(null, value);
        });
        return value;
    }, function (error) {
        setImmediate(function () {
            callback(error);
        });
        throw error;
    });
}
function promiseOrCallback (callback, executor) {
    var promise = new Promise(executor);

    // no callback: do not attach
    if (typeof callback !== 'function') {
        return promise;
    }

    return promise.then(function (value) {
        setImmediate(function () {
            callback(null, value);
        });
        return value;
    }, function (error) {
        setImmediate(function () {
            callback(error);
        });
        throw error;
    });
}
function promiseOrCallback ( callback , executor ) { var promise = new Promise ( executor ) ; // no callback: do not attach if ( typeof callback !== 'function' ) { return promise ; } return promise . then ( function ( value ) { setImmediate ( function ( ) { callback ( null , value ) ; } ) ; return value ; } , function ( error ) { setImmediate ( function ( ) { callback ( error ) ; } ) ; throw error ; } ) ; }
Build a promise, with an optional node-style callback attached
Build a promise with an optional node - style callback attached