Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
find-conditional-comments
Advanced tools
Finds all conditional comments in a string
$ npm install find-conditional-comments
const findConditionalComments = require('find-conditional-comments');
const html = `
<!--[if mso]>
Hello, Microsoft Outlook!
<![endif]-->
`
findConditionalComments(html);
//=> [ { open: "<!--[if mso]>", close: "<![endif]-->", range: [1, 63], downlevel: "hidden" } ]
Returns an Array of Objects for each comment with the following properties:
boolean
Whether the comment is an HTML comment. This might be false
for certain items when downlevel
is revealed
.
String
Opening portion of the conditional comment.
String
Closing portion of the conditional comment.
boolean
Whether the comment "bubbles" around the value.
When true
, the comment is visible to all platforms except those that support conditional comments.
<!--[if !mso]>-->
Hello, Not Microsoft Outlook!
<!--<![endif]-->
When false
, the comment is hidden from all platforms except those that support conditional comments.
<!--[if mso]>
Hello, Microsoft Outlook!
<![endif]-->
String
Either hidden
or revealed
.
hidden
means the comment is hidden from all platforms except those that support conditional comments.
revealed
means the comment is visible to all platforms except those that support conditional comments.
This is very similar to the bubble
property, but it's not the same.
downlevel
always be revealed
if bubble
is true
.
But bubble
can be true
even if downlevel
is hidden
when using this syntax:
<![if lt IE 8]>
<p>Please upgrade to Internet Explorer version 8.</p>
<![endif]>
Array
A range array containing the start and end indices of the comment.
FAQs
Finds all conditional comments in a string
We found that find-conditional-comments demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.