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.
Is this value a JS regex? Works cross-realm/iframe, and despite ES6 @@toStringTag
The is-regex npm package is a utility for checking if a value is a regular expression. It is primarily used to determine whether a given value is an instance of a RegExp object.
Check if a value is a RegExp
This feature allows you to verify if a value is a regular expression by returning a boolean result. It's useful when you need to ensure that a variable contains a valid RegExp object before performing operations that are specific to regular expressions.
const isRegex = require('is-regex');
console.log(isRegex(/abc/)); // true
console.log(isRegex('abc')); // false
Similar to is-regex, is-regexp is a package that checks if a value is a regular expression. It provides a similar functionality but may have different implementation details or dependencies.
This is a Lodash module to check if a value is classified as a RegExp object. While it offers similar functionality, it comes from the Lodash library which is a broader utility toolkit and might be preferred in projects already using Lodash.
Is this value a JS regex? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
var isRegex = require('is-regex');
var assert = require('assert');
assert.notOk(isRegex(undefined));
assert.notOk(isRegex(null));
assert.notOk(isRegex(false));
assert.notOk(isRegex(true));
assert.notOk(isRegex(42));
assert.notOk(isRegex('foo'));
assert.notOk(isRegex(function () {}));
assert.notOk(isRegex([]));
assert.notOk(isRegex({}));
assert.ok(isRegex(/a/g));
assert.ok(isRegex(new RegExp('a', 'g')));
Simply clone the repo, npm install
, and run npm test
FAQs
Is this value a JS regex? Works cross-realm/iframe, and despite ES6 @@toStringTag
We found that is-regex demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.