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

Function splitPlus

src/resolution/frameworks/angular-router.ts:205–225  ·  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

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