Comparing version 0.6.4 to 0.6.5
@@ -137,3 +137,10 @@ 'use strict'; | ||
closeIdx = code.indexOf(symbol, closeIdx + 1); | ||
} while (closeIdx > 0 && code[closeIdx - 1] === '\\' && (closeIdx < 2 || code[closeIdx - 2] !== '\\')); | ||
if (closeIdx > 0) { | ||
var shIdx = closeIdx; | ||
while (code[--shIdx] === '\\'); | ||
if ((closeIdx - shIdx) % 2) { | ||
break; | ||
} | ||
} | ||
} while (closeIdx > 0); | ||
if (closeIdx < 0) { | ||
@@ -140,0 +147,0 @@ break; |
{ | ||
"name": "decomment", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"description": "Removes comments from JSON, JavaScript, CSS, HTML, etc.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -26,2 +26,12 @@ 'use strict'; | ||
expect(decomment('`\\\\`')).toBe('`\\\\`'); | ||
expect(decomment("'\\\\\\''")).toBe("'\\\\\\''"); | ||
expect(decomment("'\\\\\\'';")).toBe("'\\\\\\'';"); | ||
expect(decomment('"\\\\\\""')).toBe('"\\\\\\""'); | ||
expect(decomment('"\\\\\\"";')).toBe('"\\\\\\"";'); | ||
expect(decomment('`\\\\\\``')).toBe('`\\\\\\``'); | ||
expect(decomment('`\\\\\\``;')).toBe('`\\\\\\``;'); | ||
}); | ||
@@ -28,0 +38,0 @@ }); |
32184
696