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.
The hsl-regex package provides a regular expression specifically designed to match HSL (Hue, Saturation, Lightness) color codes in strings. This can be particularly useful for validating and extracting HSL color values from text content in web development and software projects that deal with color data.
HSL Color Matching
This feature allows you to match HSL color values within a string. The provided code sample demonstrates how to use the hsl-regex package to find HSL values in a CSS style declaration.
const hslRegex = require('hsl-regex');
const text = 'background-color: hsl(210, 50%, 50%);';
const matches = text.match(hslRegex());
console.log(matches);
Similar to hsl-regex, color-regex offers regex patterns for matching various color formats, including HSL. It provides a broader scope by supporting not only HSL but also HEX, RGB, and other color models. This makes color-regex more versatile if you need support for multiple color formats.
While rgb-regex is focused on matching RGB color formats, it serves a similar purpose to hsl-regex by providing regex patterns for color values. It is less suitable if you specifically need to match HSL colors but is ideal for projects that predominantly deal with RGB color data.
Regex for matching HSL colors.
npm install --save hsl-regex
var hslRegex = require('hsl-regex');
hslRegex({ exact: true }).test('hsl(123, 45%, 67%)'); // => true
hslRegex({ exact: true }).test('foo bar'); // => false
hslRegex({ exact: true }).exec('hsl(1, 1.111%, 1.1111%)');
// => [
// 'hsl(1, 1.111%, 1.1111%)',
// '1',
// '1.111%',
// '1.1111%',
// index: 0,
// input: 'hsl(1, 1.111%, 1.1111%)'
// ]
'hsl(123, 45%, 67%) cats and dogs'.match(hslRegex());
// = ['hsl(123, 45%, 67%)']
MIT
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)Crafted with <3 by John Otander (@4lpine).
This package was initially generated with yeoman and the p generator.
FAQs
Regex for matching HSL colors.
The npm package hsl-regex receives a total of 1,385,234 weekly downloads. As such, hsl-regex popularity was classified as popular.
We found that hsl-regex 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.