Nefarious Planetary Meddling

    @iota/unit-converter
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0-beta.30 • Public • Published

    @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.

    Param Type Description
    value String | integer | float Number of IOTA tokens
    fromUnit String Unit of the value argument
    toUnit String Unit 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');

    Install

    npm i @iota/unit-converter

    DownloadsWeekly Downloads

    59

    Version

    1.0.0-beta.30

    License

    MIT

    Unpacked Size

    23.5 kB

    Total Files

    18

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar
    • avatar