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
|
|
|
|
|
2016-11-15 21:46:23 +00:00
|
|
|
'use strict';
|
2015-07-01 11:43:25 +00:00
|
|
|
exports.createPromiseCallback = createPromiseCallback;
|
2015-12-17 18:34:10 +00:00
|
|
|
var Promise = require('bluebird');
|
2015-07-01 11:43:25 +00:00
|
|
|
|
|
|
|
function createPromiseCallback() {
|
|
|
|
var cb;
|
2015-12-17 18:34:10 +00:00
|
|
|
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;
|
|
|
|
}
|