SQL Escaper is a drop-in replacement for sqlstring that uses an AST-based approach for faster SQL escaping and formatting, with TypeScript types and ESM/CJS support. Current version is 1.3.3, released actively with weekly/monthly updates on npm. It provides ~40% faster performance, support for BigInt and Uint8Array, and fixes a previously reported SQL injection vulnerability in older mysqljs/mysql versions. Key differentiators: security-aware, modern target (Node 12+, Bun, Deno), and proper keyword/value distinction.
npm install sql-escaperNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates named imports, identifier and value escaping, format query building, Uint8Array/BigInt support, and optional mysql2 integration.
Ensure you do not rely on object expansion in queries; use explicit placeholders for each property.
Migrate to mysql2 (v3.17+) which uses sql-escaper natively, or test thoroughly if overriding.
Upgrade Node.js to v12 or later.
Use the npm: prefix in Deno: `import { escape } from 'npm:sql-escaper'`.Use `import { escape } from 'sql-escaper'` instead of `import escape from 'sql-escaper'`Ensure tsconfig.json has `moduleResolution: 'node'` or `'node16'`. The package ships types, so it should resolve automatically.
Use dynamic import() or switch to ESM module type in package.json: `"type": "module"`
No dependency data recorded yet.