jest-regex-util
Advanced tools
Comparing version 22.0.3 to 22.0.5
@@ -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; | ||
}; |
{ | ||
"name": "jest-regex-util", | ||
"version": "22.0.3", | ||
"version": "22.0.5", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2253
59