loopback/lib/utils.js

15 lines
338 B
JavaScript

exports.createPromiseCallback = createPromiseCallback;
var Promise = require('bluebird');
function createPromiseCallback() {
var cb;
var promise = new Promise(function(resolve, reject) {
cb = function(err, data) {
if (err) return reject(err);
return resolve(data);
};
});
cb.promise = promise;
return cb;
}