All files / app/codeCharta/ui/metricChooser/metricChooserType createAttributeTypeSelector.selector.ts

100% Statements 8/8
100% Branches 2/2
100% Functions 2/2
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 1111x   11x 11x   11x 26x 16x 16x    
import { createSelector } from "@ngrx/store"
import { AttributeTypes, PrimaryMetrics } from "../../../codeCharta.model"
import { primaryMetricNamesSelector } from "../../../state/selectors/primaryMetrics/primaryMetricNames.selector"
import { attributeTypesSelector } from "../../../state/store/fileSettings/attributeTypes/attributeTypes.selector"
 
export const createAttributeTypeSelector = (metricType: keyof AttributeTypes, metricFor: keyof PrimaryMetrics) =>
    createSelector(primaryMetricNamesSelector, attributeTypesSelector, (primaryMetricNames, attributeTypes) => {
        const metricName = primaryMetricNames[metricFor]
        return attributeTypes[metricType][metricName] === "relative" ? "x͂" : "Σ"
    })