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

find-conditional-comments

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

find-conditional-comments - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

5

index.js

@@ -10,6 +10,9 @@ const CONDITIONAL_COMMENT_REGEX = /(<!(--)?\[if\s[()\w\s|&!]+\]>(?:<!--+>)?)((?:.|\n)*?)((?:<!--)?<!\[endif\]\2>)/gi;

const bubble = open.endsWith("-->");
comments.push({
open,
close,
downlevel: commentDashes == "--" ? "hidden" : "revealed",
bubble,
downlevel: bubble || commentDashes !== "--" ? "revealed" : "hidden",
range: [

@@ -16,0 +19,0 @@ CONDITIONAL_COMMENT_REGEX.lastIndex - match.length,

@@ -51,1 +51,21 @@ const findConditionalComments = require(".");

});
test("correctly marks comments as downlevel-revealed or downlevel-hidden", () => {
expect(
findConditionalComments(`
<!--[if true]>downlevel-hidden<![endif]-->
`)[0].downlevel
).toEqual("hidden");
expect(
findConditionalComments(`
<![if !mso]>downlevel-revealed<![endif]>
`)[0].downlevel
).toEqual("revealed");
expect(
findConditionalComments(`
<!--[if !mso]><!-->downlevel-revealed<!--<![endif]-->
`)[0].downlevel
).toEqual("revealed");
});

2

package.json
{
"name": "find-conditional-comments",
"version": "0.0.3",
"version": "0.0.4",
"description": "Finds all conditional comments in a string",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

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