loopback/lib/utils.js

20 lines
527 B
JavaScript
Raw Permalink Normal View History

2016-05-03 22:50:21 +00:00
// Copyright IBM Corp. 2015. All Rights Reserved.
// Node module: loopback
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
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;
}