Comparing version 0.8.3 to 0.8.4
@@ -70,3 +70,3 @@ 'use strict'; | ||
regEx = regEx.sort(function (a, b) { | ||
return a.start > b.start; | ||
return a.start - b.start; | ||
}); | ||
@@ -80,2 +80,6 @@ } | ||
if (inRegEx()) { | ||
if (emptyLetters) { | ||
s += emptyLetters; | ||
emptyLetters = ''; | ||
} | ||
s += '/'; | ||
@@ -103,2 +107,6 @@ continue; | ||
if (inRegEx()) { | ||
if (emptyLetters) { | ||
s += emptyLetters; | ||
emptyLetters = ''; | ||
} | ||
s += '/'; | ||
@@ -161,2 +169,6 @@ continue; | ||
if (inRegEx()) { | ||
if (emptyLetters) { | ||
s += emptyLetters; | ||
emptyLetters = ''; | ||
} | ||
s += '<'; | ||
@@ -163,0 +175,0 @@ continue; |
{ | ||
"name": "decomment", | ||
"version": "0.8.3", | ||
"version": "0.8.4", | ||
"description": "Removes comments from JSON, JavaScript, CSS, HTML, etc.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -92,10 +92,16 @@ decomment | ||
For example, CSS may contain Base64-encoded strings with comment-like symbols: | ||
Examples: | ||
* CSS may contain Base64-encoded strings with comment-like symbols: | ||
```css | ||
src: url(data:font/woff;base64,d09GRg//ABAAAAAAZ) | ||
``` | ||
And you can isolate all `url(*)` blocks by using: | ||
You can isolate all `url(*)` blocks by using: | ||
```js | ||
{ignore: /url\([\w\s:\/=\-\+;,]*\)/g} | ||
``` | ||
* If you want to isolate all jsDoc blocks, you can use the following: | ||
```js | ||
{ignore: /\/\*\*([^\*]*(\*[^\/])?)*\*\//g} | ||
``` | ||
@@ -102,0 +108,0 @@ ##### options.space ⇒ Boolean |
@@ -56,2 +56,3 @@ 'use strict'; | ||
expect(decomment.html(input, {ignore: /<!--keep[\w\s]*-->/g})).toBe(output); | ||
expect(decomment.html(" <!--keep-->", {ignore: /<!--keep[\w\s]*-->/g})).toBe(" <!--keep-->"); | ||
}); | ||
@@ -71,6 +72,13 @@ | ||
// This is not a real regExp for jsDoc, a much simpler version for the test; | ||
expect(decomment(input, {ignore: /\/\*\*[\w\s]*\*\//g})).toBe(output); | ||
var regEx = /\/\*\*([^\*]*(\*[^\/])?)*\*\//g; | ||
expect(decomment(input, {ignore: regEx})).toBe(output); | ||
expect(decomment(" /** text */", {ignore: regEx})).toBe(" /** text */"); | ||
}); | ||
describe("one-line", function () { | ||
expect(decomment("//comment", {ignore: /\/\/\w*/})).toBe("//comment"); | ||
expect(decomment(" //comment", {ignore: /\/\/\w*/})).toBe(" //comment"); | ||
}); | ||
}); |
56045
1084
174