loopback/lib/utils.js

15 lines
338 B
JavaScript
Raw Normal View History

2015-07-01 11:43:25 +00:00
exports.createPromiseCallback = createPromiseCallback;
var Promise = require('bluebird');
2015-07-01 11:43:25 +00:00
function createPromiseCallback() {
var cb;
var promise = new Promise(function(resolve, reject) {
2015-07-01 11:43:25 +00:00
cb = function(err, data) {
if (err) return reject(err);
return resolve(data);
};
});
cb.promise = promise;
return cb;
}