MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / code

Function code

src/resolution/frameworks/elysia.ts:506–525  ·  view source on GitHub ↗
(at: number, closing: boolean)

Source from the content-addressed store, hash-verified

504 };
505 /** Code from `at`; with `closing`, up to and past the `}` that ends a `${…}`. */
506 const code = (at: number, closing: boolean): number => {
507 let depth = 0;
508 for (let i = at; i < n; i++) {
509 const c = safe[i];
510 if (c === '`') {
511 i = template(i) - 1;
512 } else if ((c === '"' || c === "'") && closesOnLine(safe, i)) {
513 let end = i + 1;
514 while (end < n && safe[end] !== c) end += safe[end] === '\\' ? 2 : 1;
515 blank(i + 1, end);
516 i = end;
517 } else if (c === '{') {
518 depth++;
519 } else if (c === '}') {
520 if (depth === 0 && closing) return i + 1;
521 depth--;
522 }
523 }
524 return n;
525 };
526 code(0, false);
527 // A name followed by its parameters and a body defines a method, it calls
528 // nothing: `stream({ onFinish() { … } })`, `new ReadableStream({ start(c) { … } })`.

Callers 2

templateFunction · 0.70
codeOnlyFunction · 0.70

Calls 3

closesOnLineFunction · 0.90
templateFunction · 0.85
blankFunction · 0.70

Tested by

no test coverage detected