Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 63x 63x 63x 43x 43x 32x 11x 11x 11x 56x 22x 11x | import { hierarchy } from "d3-hierarchy"
import { CodeMapNode } from "../../../codeCharta.model"
import { returnIgnore, transformPath } from "../../../util/codeMapHelper"
export function getNodesByGitignorePath(root: CodeMapNode, gitignorePath: string): CodeMapNode[] {
gitignorePath = gitignorePath.trimStart()
if (gitignorePath.length === 0 || !root) {
return []
}
const ignoreResults = returnIgnore(gitignorePath)
const filtered = []
for (const { data } of hierarchy(root)) {
if (ignoreResults.ignoredNodePaths.ignores(transformPath(data.path)) === ignoreResults.condition) {
filtered.push(data)
}
}
return filtered
}
|