decord/source/10790_escapeStringRegexp.js

16 lines
420 B
JavaScript
Raw Normal View History

2026-08-12 06:57:52 +00:00
// Module ID: 10790
// Function ID: 10791
2026-07-20 16:05:17 +00:00
// Name: escapeStringRegexp
// Dependencies: []
2026-08-12 06:57:52 +00:00
// Module 10790 (escapeStringRegexp)
2026-07-20 16:05:17 +00:00
arg5.default = function escapeStringRegexp(str) {
2026-08-04 21:03:28 +00:00
if (typeof str !== "string") {
2026-07-20 16:05:17 +00:00
const _TypeError = TypeError;
const typeError = new TypeError("Expected a string");
throw typeError;
} else {
return str.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
}
};