allow unpatching regex patches (in theory)

master
Drake 2 years ago
parent bd05493e40
commit ef3fe6490a

2
dist/build.js vendored

File diff suppressed because one or more lines are too long

@ -66,10 +66,12 @@ function after(parentObj: any, name: string, func: AfterFunc) {
//idea shamelessly ripped from vencord, but done slightly differently (ie allowing for targetting specific webpack functions)
function regexPatch(match: RegExp | string, replace: string, obj: any, prop: string) {
let oldfunc = obj[prop]
let str: string = obj[prop].toString()
str = str.replaceAll(match, replace)
let newfunc = (new Function("return " + str))()
obj[prop] = newfunc
return () => obj[prop] = oldfunc
}

Loading…
Cancel
Save