Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

sql-escaper

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sql-escaper - npm Package Compare versions

Comparing version
1.3.2
to
1.3.3
+16
-0
lib/index.js

@@ -28,2 +28,3 @@ "use strict";

singleQuote: 39,
backtick: 96,
backslash: 92,

@@ -82,2 +83,15 @@ dash: 45,

}
if (currentChar === charCode.backtick) {
const length = sql.length;
for (let cursor = position + 1; cursor < length; cursor++) {
if (sql.charCodeAt(cursor) !== charCode.backtick)
continue;
if (sql.charCodeAt(cursor + 1) === charCode.backtick) {
cursor++;
continue;
}
return cursor + 1;
}
return length;
}
if (currentChar === charCode.dash && nextChar === charCode.dash) {

@@ -100,2 +114,3 @@ const lineBreak = sql.indexOf('\n', position + 2);

if (code === charCode.singleQuote ||
code === charCode.backtick ||
code === charCode.dash ||

@@ -116,2 +131,3 @@ code === charCode.slash) {

if (code === charCode.singleQuote ||
code === charCode.backtick ||
code === charCode.dash ||

@@ -118,0 +134,0 @@ code === charCode.slash) {

+15
-2

@@ -21,2 +21,3 @@ import { Buffer } from "node:buffer";

singleQuote: 39,
backtick: 96,
backslash: 92,

@@ -62,2 +63,14 @@ dash: 45,

}
if (currentChar === charCode.backtick) {
const length = sql.length;
for (let cursor = position + 1; cursor < length; cursor++) {
if (sql.charCodeAt(cursor) !== charCode.backtick) continue;
if (sql.charCodeAt(cursor + 1) === charCode.backtick) {
cursor++;
continue;
}
return cursor + 1;
}
return length;
}
if (currentChar === charCode.dash && nextChar === charCode.dash) {

@@ -78,3 +91,3 @@ const lineBreak = sql.indexOf("\n", position + 2);

if (code === charCode.questionMark) return position;
if (code === charCode.singleQuote || code === charCode.dash || code === charCode.slash) {
if (code === charCode.singleQuote || code === charCode.backtick || code === charCode.dash || code === charCode.slash) {
const contextEnd = skipSqlContext(sql, position);

@@ -91,3 +104,3 @@ if (contextEnd !== -1) position = contextEnd - 1;

const lower = code | 32;
if (code === charCode.singleQuote || code === charCode.dash || code === charCode.slash) {
if (code === charCode.singleQuote || code === charCode.backtick || code === charCode.dash || code === charCode.slash) {
const contextEnd = skipSqlContext(sql, position);

@@ -94,0 +107,0 @@ if (contextEnd !== -1) {

+1
-1
{
"name": "sql-escaper",
"version": "1.3.2",
"version": "1.3.3",
"description": "🛡️ Faster SQL escape and format for JavaScript (Node.js, Bun, and Deno).",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",