MCPcopy Index your code
hub / github.com/Acode-Foundation/Acode / execParsedCode

Function execParsedCode

src/lib/console.js:648–668  ·  view source on GitHub ↗
(parsed)

Source from the content-addressed store, hash-verified

646 return res;
647
648 function execParsedCode(parsed) {
649 let extra = "";
650 parsed.map((st) => {
651 if (st.type === "VariableDeclaration") {
652 if (["const", "let"].indexOf(st.kind) < 0) return;
653
654 const exCode = code.substring(st.start, st.end) + ";";
655 extra += exCode;
656 }
657 });
658
659 if (extra) {
660 const script = tag("script");
661 script.textContent = extra;
662 document.body.appendChild(script);
663 document.body.removeChild(script);
664 return exec(code);
665 } else {
666 return exec(code);
667 }
668 }
669
670 function exec(code) {
671 let res = null;

Callers 1

executeFunction · 0.85

Calls 1

execFunction · 0.70

Tested by

no test coverage detected