Files
clash-proxy/src/polyfills/RegExp.js
Tunglies d9a5c11d6a refactor: improve code readability and consistency in proxy-chain and uri-parser utilities
refactor: add keys to icons in routers for improved rendering and performance
refactor: optimize RegExp polyfill by using Object.prototype.hasOwnProperty.call
refactor: reorder imports in chain-proxy-provider for consistency
refactor: remove unused "obfs-opts" property from IProxySnellConfig interface

refactor: reorganize imports and enhance refresh logic in app data provider

refactor: re-enable prop-types linting for better type safety in BaseDialog component

refactor: update dependencies in effect hooks for improved stability and performance
2025-09-20 11:19:36 +08:00

41 lines
874 B
JavaScript

(function () {
if (typeof window.RegExp === "undefined") {
return;
}
const originalRegExp = window.RegExp;
window.RegExp = function (pattern, flags) {
if (pattern instanceof originalRegExp && flags === undefined) {
flags = pattern.flags;
}
if (flags) {
if (
!Object.prototype.hasOwnProperty.call(
originalRegExp.prototype,
"unicodeSets",
)
) {
if (flags.includes("v")) {
flags = flags.replace("v", "u");
}
}
if (
!Object.prototype.hasOwnProperty.call(
originalRegExp.prototype,
"hasIndices",
)
) {
if (flags.includes("d")) {
flags = flags.replace("d", "");
}
}
}
return new originalRegExp(pattern, flags);
};
window.RegExp.prototype = originalRegExp.prototype;
})();