0.1.4 • Published 4 years ago
@nawt/units v0.1.4
@nawt/units
A library for unit conversion and other unit related utilities.
Install
# For NPM
npm install @nawt/units
# For Yarn
yarn add @nawt/units
# For PNPM
pnpm install @nawt/unitsAPI
pxToEm(value: string, baseSize: number)
Converts px to em string.
import { pxToEm } from '@nawt/units';
pxToEm('48px'); // returns 3empxToRem(value: string, baseSize: number)
Converts px to rem string.
import { pxToRem } from '@nawt/units';
pxToRem('48px'); // returns 3rememToPx(value: string, baseSize: number)
Converts em to px string.
import { emToPx } from '@nawt/units';
emToPx('3em'); // returns 48pxremToPx(value: string, baseSize: number)
Converts em to px string.
import { remToPx } from '@nawt/units';
remToPx('3em'); // returns 48px