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

Function skipString

src/resolution/frameworks/object-literal.ts:40–56  ·  view source on GitHub ↗
(s: string, at: number)

Source from the content-addressed store, hash-verified

38
39/** The index of the quote closing the string or template opened at `at`, or -1. */
40export function skipString(s: string, at: number): number {
41 const quote = s[at]!;
42 for (let i = at + 1; i < s.length; i++) {
43 const ch = s[i]!;
44 if (ch === '\\') {
45 i++;
46 continue;
47 }
48 if (ch === quote) return i;
49 if (quote === '`' && ch === '$' && s[i + 1] === '{') {
50 const end = matchBracket(s, i + 1);
51 if (end < 0) return -1;
52 i = end;
53 }
54 }
55 return -1;
56}
57
58/** Each `{…}` written directly in `[from, to)`, as its own extent. */
59export function* topLevelObjects(s: string, from: number, to: number): Generator<{ start: number; end: number }> {

Callers 15

componentsInFunction · 0.90
fieldValueFunction · 0.90
blankStringsFunction · 0.90
expressionEndFunction · 0.90
topLevelPartsFunction · 0.90
statementEndFunction · 0.90
readTopLevelFunction · 0.90
staticStringFunction · 0.90
pathSegmentsFunction · 0.90
splitPlusFunction · 0.90
commandsHrefFunction · 0.90
propertyInitializerFunction · 0.90

Calls 1

matchBracketFunction · 0.85

Tested by

no test coverage detected