22 lines
561 B
JavaScript
22 lines
561 B
JavaScript
// Copyright IBM Corp. 2015,2019. All Rights Reserved.
|
|
// Node module: loopback-connector
|
|
// This file is licensed under the MIT License.
|
|
// License text available at https://opensource.org/licenses/MIT
|
|
|
|
'use strict';
|
|
const Promise = require('bluebird');
|
|
|
|
exports.createPromiseCallback = createPromiseCallback;
|
|
|
|
function createPromiseCallback() {
|
|
let cb;
|
|
const promise = new Promise(function(resolve, reject) {
|
|
cb = function(err, data) {
|
|
if (err) return reject(err);
|
|
return resolve(data);
|
|
};
|
|
});
|
|
cb.promise = promise;
|
|
return cb;
|
|
}
|