Javascript parser for google/sqlcommenter comments. Learn how to add comments to SQL queries made by Laravel at laravel-sql-commenter.
We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.
npm install sql-comment-parser
yarn add sql-comment-parser
import { parse } from 'sql-comment-parser';
const { query, comments } = parse("SELECT * FROM FOO /*action='%2Fparam*d',controller='index',framework='spring',traceparent='00-5bd66ef5095369c7b0d1f8f4bd33716a-c532cb4098ac3dd2-01',tracestate='congo%3Dt61rcWkgMzE%2Crojo%3D00f067aa0ba902b7'*/");
//=> query: "SELECT * FROM FOO"
//=> comments: { action: "/param*d", controller: "index", framework: "spring", traceparent: "00-5bd66ef5095369c7b0d1f8f4bd33716a-c532cb4098ac3dd2-01", tracestate: "congo=t61rcWkgMzE,rojo=00f067aa0ba902b7" }
The input may or may not include a valid sql comment. This parser will not check the validity of the input and will do a best effort.
Please see releases for more information what has changed recently.
npm run test
Please see CONTRIBUTING for details.
If you've found a bug regarding security please mail security@spatie.be instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.