Skip to content

Commit c4544be

Browse files
authored
Merge pull request #1551 from Fdawgs/ref/regex
perf: remove unused regex capture groups
2 parents 2e33052 + 9a240ac commit c4544be

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/base/prepared-statement.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class PreparedStatement extends EventEmitter {
9191
*/
9292

9393
input (name, type) {
94-
if ((/(--| |\/\*|\*\/|')/).test(name)) {
94+
if (/--| |\/\*|\*\/|'/.test(name)) {
9595
throw new PreparedStatementError(`SQL injection warning for param '${name}'`, 'EINJECT')
9696
}
9797

@@ -144,7 +144,7 @@ class PreparedStatement extends EventEmitter {
144144
*/
145145

146146
output (name, type) {
147-
if (/(--| |\/\*|\*\/|')/.test(name)) {
147+
if (/--| |\/\*|\*\/|'/.test(name)) {
148148
throw new PreparedStatementError(`SQL injection warning for param '${name}'`, 'EINJECT')
149149
}
150150

lib/base/request.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ class Request extends EventEmitter {
107107
*/
108108

109109
input (name, type, value) {
110-
if ((/(--| |\/\*|\*\/|')/).test(name)) {
110+
if (/--| |\/\*|\*\/|'/.test(name)) {
111111
throw new RequestError(`SQL injection warning for param '${name}'`, 'EINJECT')
112112
}
113113

@@ -170,7 +170,7 @@ class Request extends EventEmitter {
170170
output (name, type, value) {
171171
if (!type) { type = TYPES.NVarChar }
172172

173-
if ((/(--| |\/\*|\*\/|')/).test(name)) {
173+
if (/--| |\/\*|\*\/|'/.test(name)) {
174174
throw new RequestError(`SQL injection warning for param '${name}'`, 'EINJECT')
175175
}
176176

0 commit comments

Comments
 (0)