scrivito
Version:
Scrivito is a professional, yet easy to use SaaS Enterprise Content Management Service, built for digital agencies and medium to large businesses. It is completely maintenance-free, cost-effective, and has unprecedented performance and security.
15 lines (11 loc) • 370 B
text/typescript
export function computeAncestorPaths(path: string): string[] {
const ancestorPaths = ['/'];
if (path === '/') return ancestorPaths;
const components = path.split('/').slice(1);
let ancestorPath = '';
components.forEach((component) => {
ancestorPath = `${ancestorPath}/${component}`;
ancestorPaths.push(ancestorPath);
});
return ancestorPaths;
}