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

ethereumjs-units

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethereumjs-units

Ethereum unit conversion.

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
313
increased by80.92%
Maintainers
1
Weekly downloads
 
Created
Source

ethereumjs-units

NPM Package Build Status Coverage Status Gitter or #ethereumjs on freenode

Unit conversion utility.

There are two methods:

  • convert(value, unitFrom, unitTo) - convert a value between two units
  • lazyConvert(value, unitTo) - include unit type in the input and the output

The value and the output in all cases is a string.

Examples

Units.convert('1', 'eth', 'wei') // '1000000000000000000'
Units.convert('1', 'wei', 'eth') // '0.000000000000000001'
Units.convert('1', 'finney', 'eth') // '0.001'

Units.lazyConvert('1 eth', 'wei') // '1000000000000000000 wei'
Units.lazyConvert('1 wei', 'eth') // '0.000000000000000001 eth'
Units.lazyConvert('1 finney', 'eth') // '0.001 eth'

Units

Units are defined in units.json. It is compatible with web3.js and additionally includes ETH.

Keywords

FAQs

Package last updated on 13 Apr 2016

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