MCPcopy Create free account
hub / github.com/cloudflare/computer / normalizeAbsolute

Function normalizeAbsolute

packages/computer/src/git/reads.ts:307–313  ·  view source on GitHub ↗
(p: string)

Source from the content-addressed store, hash-verified

305}
306
307function normalizeAbsolute(p: string): string {
308 // Collapse a trailing slash (except the root) so the parent
309 // walk doesn't stall on `/foo/`.
310 let out = p.startsWith("/") ? p : `/${p}`;
311 while (out.length > 1 && out.endsWith("/")) out = out.slice(0, -1);
312 return out;
313}
314
315// ---------------------------------------------------------------
316// current-branch

Callers 1

repoRootWithFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected