Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

decomment

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decomment - npm Package Compare versions

Comparing version 0.7.3 to 0.7.4

20

lib/parser.js

@@ -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");

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc