Skip to content

Commit 63b9e85

Browse files
authored
fix: variableMap injection by using regex (#127)
Awesome! Thanks! 🚀
1 parent 49ccffb commit 63b9e85

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/data-loaders/RelationalDataLoader.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,13 @@ const injectVariables = (statement, req) => {
106106
return statement;
107107
}
108108
const result = Object.keys(variableMap).reduce((statmnt, key) => {
109+
// Adds 'g' for replaceAll effect
110+
var re = new RegExp(key, 'g');
109111
if (variableMap[key] === null || typeof variableMap[key] == 'boolean') {
110-
return statmnt.replaceAll(key, `${variableMap[key]}`);
112+
return statmnt.replace(re, `${variableMap[key]}`);
111113
}
112114
// @TODO: Differentiate number from string inputs...
113-
return statmnt.replaceAll(key, `'${variableMap[key]}'`);
115+
return statmnt.replace(re, `'${variableMap[key]}'`);
114116
}, statement);
115117
return result;
116118
};

0 commit comments

Comments
 (0)