All files / app/codeCharta/state/selectors/allNecessaryRenderDataAvailable/utils areDynamicSettingsAvailable.ts

100% Statements 14/14
100% Branches 3/3
100% Functions 4/4
100% Lines 10/10

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    6x 14x 2x   12x 1x   11x 8x   3x     6x 13x  
import { ColorRange, DynamicSettings } from "../../../../codeCharta.model"
 
export const _isDynamicSettingAvailable = (name: string, setting: null | string | number | string[] | ColorRange) => {
    if (name === "edgeMetric") {
        return true
    }
    if (setting === null) {
        return false
    }
    if (typeof setting !== "object") {
        return true
    }
    return Object.values(setting).every(v => v !== null)
}
 
export const areDynamicSettingsAvailable = (dynamicSettings: Partial<DynamicSettings>) =>
    Object.entries(dynamicSettings).every(([name, value]) => _isDynamicSettingAvailable(name, value))