sql-params-format v2.0.0 extends pg-format with named parameter support for SQL query formatting. It allows using %I, %s, and %L placeholders with both positional and named arguments, and automatically converts Moment.js objects to Date objects. The library is stable with low release cadence. Differs from pg-format by supporting named parameters, while being a thin wrapper; ideal for dynamic query building in Node.js.
npm install sql-params-formatNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates named parameter formatting for SQL queries using %I, %s, %L placeholders with an object of values. Also shows fallback positional usage.
Use exact casing for parameter names in SQL string and object keys.
Review SQL string for all placeholder names; consider linting or validation.
Pass plain Date objects or strings to avoid automatic conversion.
Use Date objects instead of Moment instances.
Use `import format from 'sql-params-format'` (default) or `const format = require('sql-params-format');` in CJS.Add the missing key to the params object: `format(sql, { foo: 'value' })`.