From 715d669a18680bfab4a38c66cb6c6009b31190af Mon Sep 17 00:00:00 2001 From: kolzeq Date: Fri, 19 Feb 2021 17:58:10 +0100 Subject: [PATCH] [CONJS-161] escape function incorrect use of 'this' #149 --- lib/misc/utils.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/misc/utils.js b/lib/misc/utils.js index ace3bfc2..13919a0c 100644 --- a/lib/misc/utils.js +++ b/lib/misc/utils.js @@ -116,7 +116,7 @@ module.exports.escapeId = (opts, info, value) => { return '`' + value.replace(/`/g, '``') + '`'; }; -module.exports.escape = (opts, info, value) => { +const escapeParameters = (opts, info, value) => { if (value === undefined || value === null) return 'NULL'; switch (typeof value) { @@ -148,7 +148,7 @@ module.exports.escape = (opts, info, value) => { let out = opts.arrayParenthesis ? '(' : ''; for (let i = 0; i < value.length; i++) { if (i !== 0) out += ','; - out += this.escape(opts, info, value[i]); + out += escapeParameters(opts, info, value[i]); } if (opts.arrayParenthesis) out += ')'; return out; @@ -292,3 +292,5 @@ const escapeString = (val) => { return escaped; }; + +module.exports.escape = escapeParameters;