MCPcopy Create free account
hub / github.com/GCWing/BitFun / basenamePath

Function basenamePath

src/web-ui/src/shared/utils/pathUtils.ts:97–102  ·  view source on GitHub ↗
(fullPath: string)

Source from the content-addressed store, hash-verified

95
96/** Last path segment (file or folder name). Handles mixed `/` and `\\`. */
97export function basenamePath(fullPath: string): string {
98 if (!fullPath || typeof fullPath !== 'string') return '';
99 const i = Math.max(fullPath.lastIndexOf('/'), fullPath.lastIndexOf('\\'));
100 if (i < 0) return fullPath;
101 return fullPath.slice(i + 1);
102}
103
104/** Parent directory; supports mixed separators and Unix root (`/` parent of `/foo`). */
105export function dirnameAbsolutePath(fullPath: string): string {

Callers 3

PlanViewerFunction · 0.90
FilesPanelFunction · 0.90
PlanDisplayFunction · 0.90

Calls 1

sliceMethod · 0.80

Tested by

no test coverage detected