MCPcopy
hub / github.com/directus/directus / extractPath

Function extractPath

app/src/utils/get-root-path.ts:34–39  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

32 * @returns - Root URL of the Directus instance
33 */
34export function extractPath(path: string) {
35 const parts = path.split('/');
36 const adminIndex = parts.indexOf('admin');
37 const rootPath = '/' + parts.slice(adminIndex + 1).join('/');
38 return rootPath;
39}

Callers 2

toRelativePathFunction · 0.90

Calls 2

joinMethod · 0.80
sliceMethod · 0.80

Tested by

no test coverage detected