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

Function templateEnd

src/extraction/sfc-script.ts:256–271  ·  view source on GitHub ↗
(at: number, nesting: number)

Source from the content-addressed store, hash-verified

254
255 /** The offset after the template literal at `at`, or -1. */
256 const templateEnd = (at: number, nesting: number): number => {
257 if (nesting > MAX_TEMPLATE_NESTING || wasted > limit) return -1;
258 let j = at + 1;
259 while (j < n) {
260 const c = source.charCodeAt(j);
261 if (c === Ch.Backslash) j += 2;
262 else if (c === Ch.Backtick) return j + 1;
263 else if (c === Ch.Dollar && source.charCodeAt(j + 1) === Ch.OpenBrace) {
264 const end = expressionEnd(j + 1, nesting + 1);
265 if (end < 0) break;
266 j = end;
267 } else j++;
268 }
269 wasted += j - at;
270 return -1;
271 };
272
273 /** The offset after the `}` that closes the `{` at `at`, or -1. */
274 const expressionEnd = (at: number, nesting: number): number => {

Callers 2

expressionEndFunction · 0.70
tagEndFunction · 0.70

Calls 1

expressionEndFunction · 0.70

Tested by

no test coverage detected