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.6.2 to 0.6.3

7

lib/parser.js

@@ -128,7 +128,10 @@ 'use strict';

if (!isHtml && (symbol === '\'' || symbol === '"' || symbol === '`')) {
var closeIdx = code.indexOf(symbol, idx + 1);
if (!isHtml && (symbol === '\'' || symbol === '"' || symbol === '`') && (!idx || code[idx - 1] !== '\\')) {
if (checkRegEx && utils.indexInRegEx(idx, regEx)) {
continue;
}
var closeIdx = idx;
do {
closeIdx = code.indexOf(symbol, closeIdx + 1);
} while (closeIdx > 0 && code[closeIdx - 1] === '\\' && (closeIdx < 2 || code[closeIdx - 2] !== '\\'));
if (closeIdx < 0) {

@@ -135,0 +138,0 @@ break;

{
"name": "decomment",
"version": "0.6.2",
"version": "0.6.3",
"description": "Removes comments from JSON, JavaScript, CSS, HTML, etc.",

@@ -50,1 +50,2 @@ "main": "lib/index.js",

}

@@ -11,6 +11,17 @@ 'use strict';

describe("special slash case", function () {
describe("special slash cases", function () {
it("must be ignored", function () {
expect(decomment("'\f'")).toBe("'\f'");
expect(decomment("'\\''")).toBe("'\\''");
expect(decomment('"\\""')).toBe('"\\""');
expect(decomment('`\\``')).toBe('`\\``');
expect(decomment("'\\'\\''")).toBe("'\\'\\''");
expect(decomment('"\\"\\""')).toBe('"\\"\\""');
expect(decomment('`\\`\\``')).toBe('`\\`\\``');
expect(decomment("'\\\\'")).toBe("'\\\\'");
expect(decomment('"\\\\"')).toBe('"\\\\"');
expect(decomment('`\\\\`')).toBe('`\\\\`');
});

@@ -17,0 +28,0 @@ });

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