primer cambio
This commit is contained in:
29
node_modules/promise-mysql/lib/helper.js
generated
vendored
Normal file
29
node_modules/promise-mysql/lib/helper.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
const Promise = require('bluebird');
|
||||
|
||||
module.exports = {
|
||||
promiseCallback: function(functionName, params, returnArgumentsArray = false) {
|
||||
params = Array.prototype.slice.call(params, 0);
|
||||
return new Promise((resolve, reject) => {
|
||||
params.push(function(err) {
|
||||
const args = Array.prototype.slice.call(arguments, 1);
|
||||
|
||||
if (err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
process.nextTick(() => {
|
||||
if (returnArgumentsArray) {
|
||||
args.push(call);
|
||||
return resolve(args)
|
||||
}
|
||||
|
||||
return resolve(args[0]);
|
||||
})
|
||||
});
|
||||
|
||||
const call = this[functionName].apply(this, params);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user