From 6f4ff1c115effa3cfb105afff18b945dbe19f68b Mon Sep 17 00:00:00 2001 From: Samual Norman Date: Thu, 17 Jun 2021 16:23:32 +0100 Subject: [PATCH] swap out dot notation accesses to `prototype` and `__proto__` for index notation --- src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.ts b/src/index.ts index 4d13524..1fcea55 100644 --- a/src/index.ts +++ b/src/index.ts @@ -566,6 +566,8 @@ export async function processScript(script: string) { script = script .replace(/\$[\w\$]+\(/g, a => a.replace("$", "#").replace(/\$/g, ".")) .replace(/\$G[^\w]/g, a => a.replace("$", "#")) + .replace(/\.prototype/g, `["prototype"]`) + .replace(/\.__proto__/g, `["__proto__"]`) if (autocompleteMatch) script = script.replace(/function \(.*\) \{/, `$& // ${(autocompleteMatch[1] || autocompleteMatch[2]).trim()}`) -- knotmirror 0.0.1