All files / src/render/dom/value-types dimensions.ts

100% Statements 7/7
100% Branches 0/0
100% Functions 1/1
100% Lines 6/6

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 1540x 40x 40x         40x         40x 254x  
import { degrees, number, percent, px, vh, vw } from "style-value-types"
import { testValueType } from "./test"
import { auto } from "./type-auto"
 
/**
 * A list of value types commonly used for dimensions
 */
export const dimensionValueTypes = [number, px, percent, degrees, vw, vh, auto]
 
/**
 * Tests a dimensional value against the list of dimension ValueTypes
 */
export const findDimensionValueType = (v: any) =>
    dimensionValueTypes.find(testValueType(v))