Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Parameter keys beginning with ':' & '@' #50

Merged
merged 1 commit into from
Oct 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions patches/named-placeholders+1.1.2.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/named-placeholders/index.js b/node_modules/named-placeholders/index.js
index 527d723..e50595d 100644
index 527d723..1ac61d5 100644
--- a/node_modules/named-placeholders/index.js
+++ b/node_modules/named-placeholders/index.js
@@ -3,7 +3,7 @@
Expand All @@ -11,8 +11,17 @@ index 527d723..e50595d 100644
DQUOTE = 34,
SQUOTE = 39,
BSLASH = 92;
@@ -96,13 +96,13 @@ function createCompiler(config) {
@@ -94,15 +94,22 @@ function createCompiler(config) {
if (typeof params == 'undefined')
throw new Error('Named query contains placeholders, but parameters object is undefined');

+ for(const key in params) {
+ if(key.charAt(0) === '@' || key.charAt(0) === ':') {
+ params[key.substring(1)] = params[key];
+ delete params[key];
+ }
+ }
+
const tokens = tree[1];
for (let i=0; i < tokens.length; ++i) {
- arr.push(params[tokens[i]]);
Expand All @@ -27,7 +36,7 @@ index 527d723..e50595d 100644
return s.slice(0, -1);
}
return s;
@@ -115,7 +115,7 @@ function createCompiler(config) {
@@ -115,7 +122,7 @@ function createCompiler(config) {

let unnamed = noTailingSemicolon(tree[0][0]);
for (let i=1; i < tree[0].length; ++i) {
Expand All @@ -36,7 +45,7 @@ index 527d723..e50595d 100644
unnamed += config.placeholder;
}
unnamed += config.placeholder;
@@ -124,7 +124,7 @@ function createCompiler(config) {
@@ -124,7 +131,7 @@ function createCompiler(config) {

const last = tree[0][tree[0].length -1];
if (tree[0].length == tree[1].length) {
Expand Down