loopback-component-storage/lib/utils.js

21 lines
548 B
JavaScript
Raw Normal View History

2020-02-10 18:57:12 +00:00
// Copyright IBM Corp. 2018,2019. All Rights Reserved.
2019-05-07 13:41:29 +00:00
// 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;
}