Skip to content

Commit

Permalink
Merge pull request #1551 from Fdawgs/ref/regex
Browse files Browse the repository at this point in the history
perf: remove unused regex capture groups
  • Loading branch information
dhensby authored Sep 12, 2023
2 parents 2e33052 + 9a240ac commit c4544be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/base/prepared-statement.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class PreparedStatement extends EventEmitter {
*/

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

Expand Down Expand Up @@ -144,7 +144,7 @@ class PreparedStatement extends EventEmitter {
*/

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

Expand Down
4 changes: 2 additions & 2 deletions lib/base/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class Request extends EventEmitter {
*/

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

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

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

Expand Down

0 comments on commit c4544be

Please sign in to comment.