MCPcopy Create free account
hub / github.com/boringstack-xyz/boringstack / normalize

Function normalize

tools/spec-loop/hooks/gate.ts:118–125  ·  view source on GitHub ↗
(rawPath: string, root: string)

Source from the content-addressed store, hash-verified

116}
117
118function normalize(rawPath: string, root: string): string {
119 const expanded = rawPath.startsWith("~")
120 ? rawPath.replace(/^~/, process.env.HOME ?? "~")
121 : rawPath;
122 const abs = isAbsolute(expanded) ? expanded : resolve(root, expanded);
123 const rel = relative(resolve(root), resolve(abs));
124 return rel.split(sep).join(posix.sep);
125}
126
127function extractPaths(payload: unknown, root: string): string[] {
128 if (typeof payload !== "object" || payload === null) {

Callers 1

extractPathsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected