@nawt/units
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

@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/units

API

pxToEm(value: string, baseSize: number)

Converts px to em string.

import { pxToEm } from '@nawt/units';

pxToEm('48px'); // returns 3em

pxToRem(value: string, baseSize: number)

Converts px to rem string.

import { pxToRem } from '@nawt/units';

pxToRem('48px'); // returns 3rem

emToPx(value: string, baseSize: number)

Converts em to px string.

import { emToPx } from '@nawt/units';

emToPx('3em'); // returns 48px

remToPx(value: string, baseSize: number)

Converts em to px string.

import { remToPx } from '@nawt/units';

remToPx('3em'); // returns 48px

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.42latest

Version History

VersionDownloads (Last 7 Days)Published
0.1.42
0.1.31
0.1.21

Package Sidebar

Install

npm i @nawt/units

Weekly Downloads

4

Version

0.1.4

License

MIT

Unpacked Size

48 kB

Total Files

7

Last publish

Collaborators

  • heyjules