CRAP | Complexity | Coverage | Location |
---|---|---|---|
3.00 | 3 | 8/8 (100.00%) | crap/crap-report.service.ts (L140 - L153) |
const sharedDirectories = paths.reduce((commonPrefixParts, path) => {
const pathParts = path.split("/");
const newCommonPrefixParts = [];
for (let i = 0; i < pathParts.length; i++) {
if (pathParts[i] !== commonPrefixParts[i]) {
break;
}
newCommonPrefixParts.push(pathParts[i]);
}
return newCommonPrefixParts;
}, paths[0].split("/"));