sql-tagged-template-literal

JSON →
library 1.3.0 ·javascript
verified Jun 5, 2026

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.