22 lines
557 B
JavaScript
22 lines
557 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';
|
|
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;
|
|
}
|