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

Function applyModulePrefix

src/resolution/frameworks/nestjs.ts:664–675  ·  view source on GitHub ↗

* Recompute a route node's `name` by prepending `prefix` to the *original* * in-file path. The original is recovered from `qualifiedName`, which the * per-file extract emits as `${filePath}::${method}:${path}` and which this * pass deliberately never mutates — that's what keeps the update idempot

(route: Node, prefix: string)

Source from the content-addressed store, hash-verified

662 * pass deliberately never mutates — that's what keeps the update idempotent.
663 */
664function applyModulePrefix(route: Node, prefix: string): Node | null {
665 const sep = '::';
666 const idx = route.qualifiedName.indexOf(sep);
667 if (idx < 0) return null;
668 const tail = route.qualifiedName.slice(idx + sep.length);
669 const colon = tail.indexOf(':');
670 if (colon < 0) return null;
671 const method = tail.slice(0, colon);
672 const original = tail.slice(colon + 1);
673 const newName = `${method} ${joinHttpPath(prefix, original)}`;
674 return { ...route, name: newName, updatedAt: Date.now() };
675}
676
677// ---------------------------------------------------------------------------
678// Small string utilities (object/array literal splitters)

Callers 1

postExtractFunction · 0.85

Calls 1

joinHttpPathFunction · 0.85

Tested by

no test coverage detected