2016-10-19 10:55:35 +00:00
|
|
|
// Copyright IBM Corp. 2012,2016. All Rights Reserved.
|
|
|
|
// Node module: loopback-datasource-juggler
|
|
|
|
// This file is licensed under the MIT License.
|
|
|
|
// License text available at https://opensource.org/licenses/MIT
|
|
|
|
|
2017-03-06 23:40:47 +00:00
|
|
|
'use strict';
|
2016-10-19 10:55:35 +00:00
|
|
|
var Promise = require('bluebird');
|
|
|
|
|
|
|
|
exports.createPromiseCallback = createPromiseCallback;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|