MCPcopy Create free account
hub / github.com/chhoumann/quickadd / collectStringConstants

Function collectStringConstants

src/utils/userScriptSecrets.ts:249–262  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

247}
248
249function collectStringConstants(source: string): Map<string, string> {
250 const constants = new Map<string, string>();
251 const regex = /\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(["'`])/g;
252 let match: RegExpExecArray | null;
253
254 while ((match = regex.exec(source)) !== null) {
255 const literal = readStringLiteral(source, regex.lastIndex - 1);
256 if (!literal) continue;
257 constants.set(match[1], literal.value);
258 regex.lastIndex = literal.end;
259 }
260
261 return constants;
262}
263
264function findOptionsObjectSpans(source: string): Array<{ start: number; end: number }> {
265 const spans: Array<{ start: number; end: number }> = [];

Callers 2

findOptionsObjectSpansFunction · 0.85

Calls 2

readStringLiteralFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected