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

Function basename

packages/computer/src/workspace.ts:1271–1275  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

1269}
1270
1271function basename(path: string): string {
1272 const trimmed = path.endsWith("/") && path !== "/" ? path.slice(0, -1) : path;
1273 const index = trimmed.lastIndexOf("/");
1274 return index === -1 ? trimmed : trimmed.slice(index + 1);
1275}
1276
1277function isEnoent(err: unknown): boolean {
1278 if (!err || typeof err !== "object") return false;

Callers 3

globFunction · 0.70
statFunction · 0.70
splitGlobPatternFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected