Skip to content

Commit 3192740

Browse files
committed
refactor(js,ts): rename parameter txt to matchedSubstring
1 parent ff681aa commit 3192740

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

examples/js/express/mysql/app.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ const pool = mysql.createPool({
1616
if (!values) {
1717
return query
1818
}
19-
return query.replace(/\:(\w+)/g, function(txt, key) {
19+
return query.replace(/\:(\w+)/g, function(matchedSubstring, key) {
2020
if (values.hasOwnProperty(key)) {
2121
return this.escape(values[key])
2222
}
23-
return txt
23+
return matchedSubstring
2424
}.bind(this))
2525
}
2626
})

examples/ts/express/mysql/app.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ const pool = mysql.createPool({
1717
if (!values) {
1818
return query
1919
}
20-
return query.replace(/\:(\w+)/g, function(txt, key) {
20+
return query.replace(/\:(\w+)/g, function(matchedSubstring, key) {
2121
if (values.hasOwnProperty(key)) {
2222
return this.escape(values[key])
2323
}
24-
return txt
24+
return matchedSubstring
2525
}.bind(this))
2626
}
2727
})

src/templates/app.js.ejs

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ const pool = mysql.createPool({
1717
return query
1818
}
1919
<%- // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_function_as_the_replacement -%>
20-
return query.replace(/\:(\w+)/g, function(txt, key) {
20+
return query.replace(/\:(\w+)/g, function(matchedSubstring, key) {
2121
if (values.hasOwnProperty(key)) {
2222
return this.escape(values[key])
2323
}
24-
return txt
24+
return matchedSubstring
2525
}.bind(this))
2626
}
2727
})

src/templates/app.ts.ejs

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ const pool = mysql.createPool({
1818
return query
1919
}
2020
<%- // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_function_as_the_replacement -%>
21-
return query.replace(/\:(\w+)/g, function(txt, key) {
21+
return query.replace(/\:(\w+)/g, function(matchedSubstring, key) {
2222
if (values.hasOwnProperty(key)) {
2323
return this.escape(values[key])
2424
}
25-
return txt
25+
return matchedSubstring
2626
}.bind(this))
2727
}
2828
})

0 commit comments

Comments
 (0)