# sql-strip-comments

> Remove line and block comments from sql code

Latest version **0.0.23** (published 2016-10-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install sql-strip-comments
pnpm add sql-strip-comments
yarn add sql-strip-comments
bun add sql-strip-comments
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.23 |
| Published | 2016-10-24 |
| First published | 2016-10-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | decemberster |
| Keywords | sql, strip, comments |

## Links

- npm: https://www.npmjs.com/package/sql-strip-comments
- Repository: https://github.com/decemberster/sql-strip-comments
- Homepage: https://github.com/decemberster/sql-strip-comments#readme
- Issues: https://github.com/decemberster/sql-strip-comments/issues
- npm.io page: https://npm.io/package/sql-strip-comments

## Dependencies (1)

- [debug](https://npm.io/package/debug.md) ^2.2.0

## Recent versions

- 0.0.23 (latest) — 2016-10-24
- 0.0.22 — 2016-10-23
- 0.0.21 — 2016-10-23
- 0.0.20 — 2016-10-23
- 0.0.19 — 2016-10-23
- 0.0.18 — 2016-10-23
- 0.0.17 — 2016-10-23
- 0.0.15 — 2016-10-22
- 0.0.14 — 2016-10-22
- 0.0.13 — 2016-10-22
- 0.0.12 — 2016-10-22
- 0.0.11 — 2016-10-22
- 0.0.10 — 2016-10-22
- 0.0.9 — 2016-10-22
- 0.0.7 — 2016-10-22
- … 6 more at https://npm.io/package/sql-strip-comments/versions

## README

>[![npm](https://img.shields.io/npm/v/sql-strip-comments.svg)](https://www.npmjs.com/package/sql-strip-comments) [![npm](https://img.shields.io/npm/dm/sql-strip-comments.svg)](https://www.npmjs.com/package/sql-strip-comments) [![ghit.me](https://ghit.me/badge.svg?repo=decemberster/sql-strip-comments)](https://ghit.me/repo/decemberster/sql-strip-comments)

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
```js
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;

```

---
_Source: https://npm.io/package/sql-strip-comments · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
