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

Function splitPlus

src/resolution/frameworks/angular-router.ts:203–223  ·  view source on GitHub ↗

An expression's `+` operands at depth 0, strings and brackets stepped over.

(text: string)

Source from the content-addressed store, hash-verified

201
202/** An expression's `+` operands at depth 0, strings and brackets stepped over. */
203function splitPlus(text: string): string[] {
204 const parts: string[] = [];
205 let start = 0;
206 for (let i = 0; i < text.length; i++) {
207 const ch = text[i]!;
208 if (ch === '"' || ch === "'" || ch === '`') {
209 const end = skipString(text, i);
210 if (end < 0) return [text];
211 i = end;
212 } else if (ch === '(' || ch === '[' || ch === '{') {
213 const end = matchBracket(text, i);
214 if (end < 0) return [text];
215 i = end;
216 } else if (ch === '+') {
217 parts.push(text.slice(start, i));
218 start = i + 1;
219 }
220 }
221 parts.push(text.slice(start));
222 return parts;
223}
224
225/** The component a `component:` / `loadComponent:` value names. */
226function componentRef(field: 'component' | 'loadComponent', text: string): AngularComponentRef | null {

Callers 1

pathSegmentsFunction · 0.85

Calls 3

skipStringFunction · 0.90
matchBracketFunction · 0.90
pushMethod · 0.80

Tested by

no test coverage detected