MCPcopy Create free account
hub / github.com/EsperoTech/yaade / containsGeneratorFunction

Function containsGeneratorFunction

client/src/utils/sandboxedFunction.tsx:1–12  ·  view source on GitHub ↗
(codeString: string)

Source from the content-addressed store, hash-verified

1function containsGeneratorFunction(codeString: string): boolean {
2 // Regular expression to detect generator function declaration (function* name() {})
3 const generatorFunctionPattern = /\bfunction\s*\*/;
4
5 // Regular expression to detect arrow function generators (async function* () => {})
6 const arrowGeneratorPattern = /\*\s*=>/;
7
8 // Test the string for both patterns
9 return (
10 generatorFunctionPattern.test(codeString) || arrowGeneratorPattern.test(codeString)
11 );
12}
13
14const createSandboxedFunction = function (
15 args: Record<string, string>,

Callers 1

createSandboxedFunctionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected