0.0.23 • Published 9 years ago

sql-strip-comments v0.0.23

Weekly downloads
149
License
MIT
Repository
github
Last release
9 years ago

npm npm ghit.me

Remove line (-- comment text \n) and block (\* comment text *\) comments from sql code. Comments in string literals are not treated as comments. Nested block comments are not supported.

Install

$ npm install sql-strip-comments --save

Usage

const strip = require("sql-strip-comments");

let sql='SELECT * FROM customers; -- test comments';
console.log(1, strip(sql));
// SELECT * FROM customers; 
 
sql='SELECT * FROM customers; /* -- test comments */';
console.log(2, strip(sql));
// SELECT * FROM customers; 
 
sql=`
SELECT 
    "comments can be one line (-- comment text 
) and multiline (/* comment text */)" AS literal, 
    * 
FROM 
    customers; /* -- test comments */`;
console.log(3, strip(sql));
// SELECT "comments can be one line (-- comment text 
// ) and multiline (/* comment text */)" AS literal, * FROM customers;
0.0.23

9 years ago

0.0.22

9 years ago

0.0.21

9 years ago

0.0.20

9 years ago

0.0.19

9 years ago

0.0.18

9 years ago

0.0.17

9 years ago

0.0.15

9 years ago

0.0.14

9 years ago

0.0.13

9 years ago

0.0.12

9 years ago

0.0.11

9 years ago

0.0.10

9 years ago

0.0.9

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago