decord/source/10612_escapeStringRegexp.js

16 lines
420 B
JavaScript
Raw Normal View History

2026-08-05 07:35:12 +00:00
// Module ID: 10612
// Function ID: 10613
2026-07-20 16:05:17 +00:00
// Name: escapeStringRegexp
// Dependencies: []
2026-08-05 07:35:12 +00:00
// Module 10612 (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");
}
};