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.
regexp-match-indices
Advanced tools
This package provides a polyfill/shim for the RegExp Match Indices proposal.
The implementation is a replacement for RegExp.prototype.exec
that approximates the beahvior of the proposal. Because RegExp.prototype.exec
depends on a receiver (the this
value), the main export accepts the RegExp
to operate on as the first argument.
npm install regexp-match-indices
const execWithIndices = require("regexp-match-indices");
const text = "zabbcdef";
const re = new RegExp("ab*(cd(?<Z>ef)?)");
const result = execWithIndices(re, text);
console.log(result.indices); // [[1, 8], [4, 8], [6, 8]]
require("regexp-match-indices").shim();
// or
require("regexp-match-indices/shim")();
// or
require("regexp-match-indices/auto");
const text = "zabbcdef";
const re = new RegExp("ab*(cd(?<Z>ef)?)");
const result = re.exec(re, text);
console.log(result.indices); // [[1, 8], [4, 8], [6, 8]]
The polyfill can be run in two modes: "lazy"
(default) or "spec-compliant"
. In "spec-compliant"
mode, the indices
property is populated and stored on the result as soon as exec()
is called. This can have a significant performance penalty for existing RegExp's that do not use this feature. By default, the polyfill operates in "lazy"
mode, where the indices
property is defined using a getter and is only computed when first requested.
You can specify the configuration globally using the following:
require("regexp-match-indices").config.mode = "spec-compliant"; // or "lazy"
// or
require("regexp-match-indices/config").mode = "spec-compliant"; // or "lazy"
FAQs
RegExp Match Indices polyfill
The npm package regexp-match-indices receives a total of 1,099,952 weekly downloads. As such, regexp-match-indices popularity was classified as popular.
We found that regexp-match-indices 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.