MCPcopy Index your code
hub / github.com/code-pushup/cli / splitFilePath

Function splitFilePath

packages/utils/src/lib/file-system.ts:149–163  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

147};
148
149export function splitFilePath(filePath: string): SplitFilePath {
150 const file = path.basename(filePath);
151 const folders: string[] = [];
152 // eslint-disable-next-line functional/no-loop-statements
153 for (
154 // eslint-disable-next-line functional/no-let
155 let dirPath = path.dirname(filePath);
156 path.dirname(dirPath) !== dirPath;
157 dirPath = path.dirname(dirPath)
158 ) {
159 // eslint-disable-next-line functional/immutable-data
160 folders.unshift(path.basename(dirPath));
161 }
162 return { folders, file };
163}
164
165export function truncatePaths(paths: string[]): string[] {
166 const segmentedPaths = paths

Callers 2

filesCoverageToTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected