All files / app/codeCharta/state/selectors/accumulatedData/utils getMetricValuesForNode.ts

100% Statements 8/8
100% Branches 1/1
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        83x 1x   1x 1x 1x 1x       1x    
import { HierarchyNode } from "d3-hierarchy"
import { CodeMapNode } from "../../../../codeCharta.model"
import { EdgeMetricCountMap, NodeEdgeMetricsMap } from "../metricData/edgeMetricData.calculator"
 
export const getMetricValuesForNode = (nodeEdgeMetricsMap: NodeEdgeMetricsMap, node: HierarchyNode<CodeMapNode>, metricNames: string[]) => {
    const nodeEdgeMetrics: EdgeMetricCountMap = new Map()
 
    for (const metricName of metricNames) {
        const edgeMetricCount = nodeEdgeMetricsMap.get(metricName)
        if (edgeMetricCount) {
            nodeEdgeMetrics.set(metricName, edgeMetricCount.get(node.data.path))
        }
    }
 
    return nodeEdgeMetrics
}