Socket
Socket
Sign inDemoInstall

units-css

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

units-css

[![Travis CI status](https://img.shields.io/travis/alexdunphy/units.svg)](https://travis-ci.org/alexdunphy/units) [![Coveralls status](https://img.shields.io/coveralls/alexdunphy/units.svg)](https://coveralls.io/r/alexdunphy/units) [![dependencies status]


Version published
Maintainers
1
Created

What is units-css?

The units-css npm package provides utilities for converting and manipulating CSS units. It simplifies the process of working with different units in CSS, such as pixels, ems, rems, percentages, and more.

What are units-css's main functionalities?

Convert units

This feature allows you to convert one CSS unit to another. In the example, 16 pixels are converted to ems based on a base size of 16 pixels.

const units = require('units-css');
const pxToEm = units.convert('16px', 'em', { base: '16px' });
console.log(pxToEm); // '1em'

Parse units

This feature parses a CSS unit string into an object containing the numeric value and the unit. In the example, '16px' is parsed into an object with value 16 and unit 'px'.

const units = require('units-css');
const parsed = units.parse('16px');
console.log(parsed); // { value: 16, unit: 'px' }

Stringify units

This feature converts an object with a value and unit back into a CSS unit string. In the example, an object with value 16 and unit 'px' is converted back to '16px'.

const units = require('units-css');
const stringified = units.stringify({ value: 16, unit: 'px' });
console.log(stringified); // '16px'

Other packages similar to units-css

FAQs

Package last updated on 30 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc