🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@iota/unit-converter

Package Overview
Dependencies
Maintainers
6
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iota/unit-converter

Converts value across different IOTA units.

latest
Source
npmnpm
Version
1.0.0-beta.30
Version published
Weekly downloads
212
-72.36%
Maintainers
6
Weekly downloads
 
Created
Source

@iota/unit-converter

Converts value across different IOTA units.

Installation

Install using npm:

npm install @iota/unit-converter

or using yarn:

yarn add @iota/unit-converter

API Reference

<a name="module_unit-converter.convertUnits"></a>

unit-converter.convertUnits(value, fromUnit, toUnit)

Summary: Converts a value of IOTA tokens from one unit to another.

ParamTypeDescription
valueString | integer | floatNumber of IOTA tokens
fromUnitStringUnit of the value argument
toUnitStringUnit to which to convert the value to

This method converts a value of IOTA tokens from a given unit to another given unit.

Valid unit names include the following:

  • i: 1
  • Ki: 1,000
  • Mi: 1,000,000
  • Gi: 1,000,000,000
  • Ti: 1,000,000,000,000
  • Pi: 1,000,000,000,000,000

Returns: number - newUnit - The number of units of IOTA tokens
Example

let newUnit = UnitConverter.convertUnits(100, 'Ti', 'Pi');

Keywords

iota

FAQs

Package last updated on 18 Jun 2020

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