A simple SQL string escape utility that escapes single quotes and optionally backslashes to prevent SQL injection. Version 1.1.0 is stable with no recent updates; it is derived from the mysqljs/sqlstring library but adds an option to disable backslash escaping, which is non-standard SQL. Unlike general-purpose escape libraries, this package focuses solely on SQL string escaping and is lightweight with no dependencies.
npm install sql-escape-stringNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage: import, escape a string with single quotes, and difference with backslashSupported option.
Always set { backslashSupported: true } if your SQL engine supports backslash escapes, or verify your engine's behavior.Update imports: require('sql-escape-string') instead of require('sql-string-escape').Explicitly pass { backslashSupported: true } or { backslashSupported: false } to make intent clear.Use a dedicated identifier escape function if needed; for numbers, convert to string manually.
npm install sql-escape-string and replace require('sql-string-escape') with require('sql-escape-string').Use 'import escapeString from 'sql-escape-string'' or 'const escapeString = require('sql-escape-string')'.npm install sql-escape-string and add import at top of file.
No dependency data recorded yet.