2019-04-18 21:32:38 +00:00
|
|
|
// Copyright IBM Corp. 2015,2019. All Rights Reserved.
|
|
|
|
// Node module: loopback-connector
|
2016-10-19 10:55:35 +00:00
|
|
|
// 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';
|
2019-08-02 13:50:51 +00:00
|
|
|
const Promise = require('bluebird');
|
2016-10-19 10:55:35 +00:00
|
|
|
|
|
|
|
exports.createPromiseCallback = createPromiseCallback;
|
|
|
|
|
|
|
|
function createPromiseCallback() {
|
2019-08-02 13:50:51 +00:00
|
|
|
let cb;
|
|
|
|
const promise = new Promise(function(resolve, reject) {
|
2016-10-19 10:55:35 +00:00
|
|
|
cb = function(err, data) {
|
|
|
|
if (err) return reject(err);
|
|
|
|
return resolve(data);
|
|
|
|
};
|
|
|
|
});
|
|
|
|
cb.promise = promise;
|
|
|
|
return cb;
|
|
|
|
}
|