MCPcopy
hub / github.com/directus/directus / extractRoot

Function extractRoot

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

Source from the content-addressed store, hash-verified

19 * @returns - Root URL of the Directus instance
20 */
21export function extractRoot(path: string) {
22 const parts = path.split('/');
23 const adminIndex = parts.indexOf('admin');
24 const rootPath = parts.slice(0, adminIndex).join('/') + '/';
25 return rootPath;
26}
27
28/**
29 * Extract the path of the admin app from a given input path/url

Callers 3

getRootPathFunction · 0.85
getPublicURLFunction · 0.85

Calls 2

joinMethod · 0.80
sliceMethod · 0.80

Tested by

no test coverage detected