Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
normalize-selector
Advanced tools
The normalize-selector npm package is designed to normalize CSS selectors by formatting them into a consistent structure. This can be particularly useful for CSS processing tasks, such as minification, linting, or when implementing CSS-in-JS solutions where consistent selector formatting is crucial. It helps in cleaning up and standardizing selectors by removing unnecessary whitespace, sorting pseudo-classes, and ensuring a uniform structure.
Normalization of CSS Selectors
This feature demonstrates how normalize-selector can take a messy CSS selector string with extra spaces and inconsistent formatting, and normalize it into a clean, standardized format. This is particularly useful for CSS optimization and ensuring consistency across a codebase.
"const normalize = require('normalize-selector');
const normalizedSelector = normalize(' ul > li:first-child ');
console.log(normalizedSelector); // Outputs: 'ul > li:first-child'"
postcss-selector-parser is a parser for CSS selectors that allows for manipulation and stringification of CSS selectors. It provides a more comprehensive API for parsing and manipulating selectors compared to normalize-selector, which focuses solely on normalization.
css-what is a package that parses CSS selectors into an understandable structure (tokens). While it doesn't directly normalize selectors in the same way as normalize-selector, it can be used as part of a toolchain to analyze and potentially reformat selectors.
Normalize CSS selectors.
Examples:
#foo>.bar
-> #foo > .bar
#foo > .bar
-> #foo > .bar
foo[ a = 'b' ]
-> foo[a='b']
Run mocha tests on node.js with:
npm test
or:
node ./test/mocha/node-suite.js
View the browser suite directly on rawgithub
The code and all the documentation are released under the MIT license.
FAQs
Normalize CSS Selectors
The npm package normalize-selector receives a total of 949,066 weekly downloads. As such, normalize-selector popularity was classified as popular.
We found that normalize-selector 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.