MCPcopy Index your code
hub / github.com/angular/angular / decompressNodeLocation

Function decompressNodeLocation

packages/core/src/hydration/compression.ts:61–75  ·  view source on GitHub ↗
(
  path: string,
)

Source from the content-addressed store, hash-verified

59 * a given node by its location.
60 */
61export function decompressNodeLocation(
62 path: string,
63): [string | number, ...(number | NodeNavigationStep)[]] {
64 const matches = path.match(REF_EXTRACTOR_REGEXP)!;
65 const [_, refNodeId, refNodeName, rest] = matches;
66 // If a reference node is represented by an index, transform it to a number.
67 const ref = refNodeId ? parseInt(refNodeId, 10) : refNodeName;
68 const steps: (number | NodeNavigationStep)[] = [];
69 // Match all segments in a path.
70 for (const [_, step, count] of rest.matchAll(/(f|n)(\d*)/g)) {
71 const repeat = parseInt(count, 10) || 1;
72 steps.push(step as NodeNavigationStep, repeat);
73 }
74 return [ref, ...steps];
75}

Callers 2

locateRNodeByPathFunction · 0.90

Calls 3

matchMethod · 0.45
matchAllMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…