util/promises.js
function promiseForCallback( fun, callback) {
        var deferred = Q.defer();
        fun( function( error, result) {
            callback(error, result, deferred);
        });
        return deferred.promise;
    }
function promiseForCallback( fun, callback) {
        var deferred = Q.defer();
        fun( function( error, result) {
            callback(error, result, deferred);
        });
        return deferred.promise;
    }
function promiseForCallback ( fun , callback ) { var deferred = Q . defer ( ) ; fun ( function ( error , result ) { callback ( error , result , deferred ) ; } ) ; return deferred . promise ; }
Returns a promise handling the function and taking a callback to state what to do with the deferred object
@param fun - the function to be executed
@param callback - the callback with signature function ( err, result, deferred)
@returns {*|promise} - the promise generated
Returns a promise handling the function and taking a callback to state what to do with the deferred object