loopback-component-storage/lib/utils.js

21 lines
543 B
JavaScript
Raw Normal View History

2019-05-07 13:41:29 +00:00
// Copyright IBM Corp. 2018. All Rights Reserved.
// Node module: loopback-component-storage
// This file is licensed under the Artistic License 2.0.
// License text available at https://opensource.org/licenses/Artistic-2.0
2018-10-15 22:17:47 +00:00
'use strict';
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;
}