All files / app/codeCharta/util parseNumberInput.ts

100% Statements 8/8
100% Branches 2/2
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 1111x 17x 17x 3x   14x 3x   11x    
export const parseNumberInput = (event: Event, min: number, max: number) => {
    const value = Number.parseInt((event.target as HTMLInputElement).value)
    if (value < min) {
        return min
    }
    if (value > max) {
        return max
    }
    return value
}