Comparing version 0.7.3 to 0.7.4
@@ -90,3 +90,3 @@ 'use strict'; | ||
var parts = comment.split(EOL); | ||
if (optSpace && parts.length > 1) { | ||
if (optSpace) { | ||
for (var k = 0; k < parts.length - 1; k++) { | ||
@@ -107,11 +107,7 @@ s += EOL; | ||
if (optSpace) { | ||
if (parts.length > 1) { | ||
s += utils.getSpaces(parts[parts.length - 1].length); | ||
} else { | ||
s += utils.getSpaces(comment.length); | ||
} | ||
s += utils.getSpaces(parts[parts.length - 1].length); | ||
} | ||
} | ||
} else { | ||
if (optSpace && parts.length > 1) { | ||
if (optSpace) { | ||
var gapIdx = idx + 1; | ||
@@ -140,3 +136,3 @@ while ((code[gapIdx] === ' ' || code[gapIdx] === '\t') && ++gapIdx < len); | ||
var parts = comment.split(EOL); | ||
if (optSpace && parts.length > 1) { | ||
if (optSpace) { | ||
for (var k = 0; k < parts.length - 1; k++) { | ||
@@ -157,11 +153,7 @@ s += EOL; | ||
if (optSpace) { | ||
if (parts.length > 1) { | ||
s += utils.getSpaces(parts[parts.length - 1].length); | ||
} else { | ||
s += utils.getSpaces(comment.length); | ||
} | ||
s += utils.getSpaces(parts[parts.length - 1].length); | ||
} | ||
} | ||
} else { | ||
if (optSpace && parts.length > 1) { | ||
if (optSpace) { | ||
var gapIdx = idx + 1; | ||
@@ -168,0 +160,0 @@ while ((code[gapIdx] === ' ' || code[gapIdx] === '\t') && ++gapIdx < len); |
{ | ||
"name": "decomment", | ||
"version": "0.7.3", | ||
"version": "0.7.4", | ||
"description": "Removes comments from JSON, JavaScript, CSS, HTML, etc.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -109,2 +109,3 @@ 'use strict'; | ||
it("must replace deleted lines with line break", function () { | ||
expect(decomment.html("prefix<!--comment-->suffix", {space: true})).toBe("prefix suffix"); | ||
expect(decomment("<!--start" + LB + "middle" + LB + "end-->text" + LB, {space: true})).toBe(LB + LB + " text" + LB); | ||
@@ -111,0 +112,0 @@ expect(decomment("<!--start" + LB + "middle" + LB + "end-->\ttext", {space: true})).toBe(LB + LB + " \ttext"); |
@@ -199,2 +199,3 @@ 'use strict'; | ||
it("must replace deleted lines with line break", function () { | ||
expect(decomment("prefix/*comment*/suffix", {space: true})).toBe("prefix suffix"); | ||
expect(decomment("/*start" + LB + "middle" + LB + "end*/text" + LB, {space: true})).toBe(LB + LB + " text" + LB); | ||
@@ -201,0 +202,0 @@ expect(decomment("/*start" + LB + "middle" + LB + "end*/\ttext", {space: true})).toBe(LB + LB + " \ttext"); |
43115
877