Socket
Socket
Sign inDemoInstall

unit-converter

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unit-converter

Javascript generic unit converter.


Version published
Maintainers
1
Created
Source

convert

Build Status

Use convenient format for writing amounts and easily convert them to useful numbers.

npm install unit-converter

Example

import { convert } from 'unit-converter';

convert('10s').to('ms');
// -> 10000

convert('1h').to('ms');
// -> 3600000

convert('2KB').to('B');
// -> 2048

convert('1MB').to('B');
// -> 1048576

Supported unit systems

Currently byte and time systems are supported.

For more details about currently supported unit systems please see lib/systems/*.js.

Keywords

FAQs

Package last updated on 21 Jan 2019

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