Socket
Socket
Sign inDemoInstall

jest-regex-util

Package Overview
Dependencies
0
Maintainers
5
Versions
106
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 22.0.3 to 22.0.5

52

build/index.js

@@ -26,5 +26,53 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.replacePathSepForRegex = exports.escapeStrForRegex = exports.escapePathForRegex = undefined;

*
*/const escapeStrForRegex = exports.escapeStrForRegex = string => string.replace(/[[\]{}()*+?.\\^$|]/g, '\\$&');const replacePathSepForRegex = exports.replacePathSepForRegex = string => {if (_path2.default.sep === '\\') {return string.replace(/(\/|\\(?!\.))/g, '\\\\');
*/const escapeStrForRegex = exports.escapeStrForRegex = string => string.replace(/[[\]{}()*+?.\\^$|]/g, '\\$&');const replacePathSepForRegex = exports.replacePathSepForRegex = string => {if (!string || _path2.default.sep !== '\\') {return string;
}
return string;
let result = '';
for (let i = 0; i < string.length; i += 1) {
const char = string[i];
if (char === '\\') {
const nextChar = string[i + 1];
/* Case: \/ -- recreate legacy behavior */
if (nextChar === '/') {
i += 1;
result += '\\\\\\\\';
continue;
}
/* Case: \. */
if (nextChar === '.') {
i += 1;
result += '\\.';
continue;
}
/* Case: \\. */
if (nextChar === '\\' && string[i + 2] === '.') {
i += 2;
result += '\\\\.';
continue;
}
/* Case: \\ */
if (nextChar === '\\') {
i += 1;
result += '\\\\';
continue;
}
/* Case: \<other> */
result += '\\\\';
continue;
}
/* Case: / */
if (char === '/') {
result += '\\\\';
continue;
}
result += char;
}
return result;
};

2

package.json
{
"name": "jest-regex-util",
"version": "22.0.3",
"version": "22.0.5",
"repository": {

@@ -5,0 +5,0 @@ "type": "git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc