Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.

vaporyjs/vaporyjs-units

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vaporyjs-units

NPM Package Build Status Coverage Status Gitter or #vaporyjs 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', 'vap', 'wei') // '1000000000000000000'
Units.convert('1', 'wei', 'vap') // '0.000000000000000001'
Units.convert('1', 'finney', 'vap') // '0.001'

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

Units

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

About

Unit conversion utility.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •