UNPKG

apphouse

Version:

Component library for React that uses observable state management and theme-able components.

15 lines (14 loc) 525 B
import { Unit } from '../../types/unit'; /** * Get value with with equivalent unit * @param value * @param unit * @returns string * * @example * console.log(getValueWithUnit(10, 'px')); // Output: "10px" * console.log(getValueWithUnit(20, 'pt')); // Output: "26.6pt" (20 * 1.33) * console.log(getValueWithUnit(15, 'sp')); // Output: "22.5sp" (15 * 1.5) * console.log(getValueWithUnit(2, 'rem')); // Output: "32rem" (2 * 16) */ export declare const getValueWithUnit: (value: number | string, unit: Unit) => string;