loopback-connector/lib/utils.js

22 lines
561 B
JavaScript
Raw Normal View History

2019-04-18 21:32:38 +00:00
// 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
2017-03-06 23:40:47 +00:00
'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;
}