An ES6 tagged template literal for escaping SQL query values, returning a sanitized SQL string. v1.3.0 supports values as MySQL-compatible escaped strings, with special handling for null/undefined (unquoted NULL), numbers (unquoted), booleans (text), objects (JSON-stringified and escaped), arrays and Sets (comma-separated), and 2D arrays for multi-row inserts. Lightweight wrapper around the mysqljs/sqlstring library. Unlike alternatives, it outputs a plain string rather than a custom query object, thus suited for simple dumps or direct query execution. Not intended for table/column name escaping.
npm install sql-tagged-template-literalNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Escapes a user-provided string value within a SQL INSERT query using a tagged template literal.
Use a whitelist or other method to safely interpolate identifiers; never directly interpolate user input for names.
Ensure objects are JSON-serializable; avoid passing Date objects without explicit conversion; use custom serialization if needed.
Pass string 'null' if you want the literal string, else accept that these map to SQL NULL.
No action needed unless sqlstring introduces vulnerabilities; watch for sqlstring updates.
Use const sql = require('sql-tagged-template-literal'); (no .default).Add import sql from 'sql-tagged-template-literal' or const sql = require('sql-tagged-template-literal').Run npm install sql-tagged-template-literal in your project directory.
No dependency data recorded yet.