瀏覽代碼

Updated self defending template #2

sanex 3 年之前
父節點
當前提交
a57657a8cc

File diff suppressed because it is too large
+ 0 - 0
dist/index.browser.js


File diff suppressed because it is too large
+ 0 - 0
dist/index.cli.js


File diff suppressed because it is too large
+ 0 - 0
dist/index.js


+ 3 - 7
src/custom-code-helpers/self-defending/templates/SelfDefendingNoEvalTemplate.ts

@@ -8,13 +8,9 @@ export function SelfDefendingNoEvalTemplate (): string {
         const {selfDefendingFunctionName} = {callControllerFunctionName}(this, function () {
             {globalVariableTemplate}
         
-            const test = function () {
-                const regExp = that.RegExp('([\\\\S]+([\\\\s]+[\\\\S]+)+)+[\\\\S]}');
-                
-                return !regExp.test({selfDefendingFunctionName});
-            };
-            
-            return test();
+            return that
+                .RegExp('([\\\\S]+([\\\\s]+[\\\\S]+)+)+[\\\\S]}')
+                .test({selfDefendingFunctionName});
         });
         
         {selfDefendingFunctionName}();

+ 5 - 10
src/custom-code-helpers/self-defending/templates/SelfDefendingTemplate.ts

@@ -6,16 +6,11 @@
 export function SelfDefendingTemplate (): string {
     return `
         const {selfDefendingFunctionName} = {callControllerFunctionName}(this, function () {
-            const test = function () {
-                const regExp = test
-                    .constructor('return /" + this + "/')
-                    .call()
-                    .constructor('([\\\\S]+([\\\\s]+[\\\\S]+)+)+[\\\\S]}');
-                
-                return !regExp.test({selfDefendingFunctionName});
-            };
-            
-            return test();
+            return {selfDefendingFunctionName}
+                .constructor('return /" + this + "/')
+                .call()
+                .constructor('([\\\\S]+([\\\\s]+[\\\\S]+)+)+[\\\\S]}')
+                .test({selfDefendingFunctionName});
         });
         
         {selfDefendingFunctionName}();

Some files were not shown because too many files changed in this diff