All files / app/codeCharta/ui/attributeSideBar/attributeSideBarHeaderSection/nodePath fileCountSelector.ts

100% Statements 8/8
100% Branches 33/33
100% Functions 1/1
100% Lines 7/7

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 196x   6x   6x 13x 5x     8x               6x  
import { selectedNodeSelector } from "../../../../state/selectors/selectedNode.selector"
import { CodeMapNode, FileCount } from "../../../../codeCharta.model"
import { createSelector } from "@ngrx/store"
 
export const getFileCount = (node?: Pick<CodeMapNode, "attributes" | "fileCount">): FileCount => {
    if (!node) {
        return
    }
 
    return {
        all: node.attributes?.unary ?? 0,
        added: node.fileCount?.added ?? 0,
        removed: node.fileCount?.removed ?? 0,
        changed: node.fileCount?.changed ?? 0
    }
}
 
export const fileCountSelector = createSelector(selectedNodeSelector, getFileCount)