A zero-dependency library to remove line (-- ...) and block (/* ... */) comments from SQL code. Version 0.0.23 is the latest as of the metadata snapshot; the package sees low to moderate releases (last update appears 2020). Differentiators: it correctly ignores comments inside string literals, and does not treat adjacent operators like `--` as comment markers when inside double-quoted strings. Works in Node.js and browsers. Alternative to regex-based solutions that often break on edge cases with strings or multiline comments.
npm install sql-strip-commentsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates removing both line and block comments from SQL, preserving newlines and string literals.
Use dynamic import() or switch to bundler that supports ESM. Alternatively pin to v0.0.22.
Avoid nested block comments in SQL input, or preprocess to handle such cases.
If your SQL uses single quotes for identifiers or strings, test edge cases.
Use `import strip from 'sql-strip-comments'` instead of `import { strip }...`Upgrade Node to 12+ and use dynamic import, or downgrade to v0.0.22.
Remove nested comments manually or use alternative library.
No dependency data recorded yet.