New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

unit-parse

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unit-parse

Parse numbers and units from css values.

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Unit Parse

NPM Version Build Status

Given an value, unit-parse will be able to parse the following units:

  • rem, em, %, px
  • vh, vw, vmin, vmax
  • cm, mm, in, pt, pc, ch, ex
  • s
const parseUnit = require('unit-parse');

parseUnit('20px'); // { value: '20', unit: 'px' }
parseUnit('15%'); // { value: '15', unit: '%' }
parseUnit('-1.5s'); // { value: '-1.5', unit: 's' }

parseUnit('20px', true); // 'px'
parseUnit('15%', true); // '%'
parseUnit('-1.5s', true); // 's'

Contributing

Have a bug? Please create an issue here on GitHub that conforms with our contributing guidelines. You can also browse the Help Wanted tag in our issue tracker to find things to do.

Security

If you discover a security vulnerability within this package, please send an e-mail directly to the Centagon Developers at developers@centagon.com. All security vulnerabilities will be promptly addressed.

License

This package is available under the MIT license.

Copyright (c) 2018 Centagon, B.V.

Keywords

FAQs

Package last updated on 30 Apr 2018

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