Wondering what’s next for npm?Check out our public roadmap! »

    ccunits

    1.0.6 • Public • Published

    ccunits

    Convert the human-readable of cryptocurrency number to minimum units, depending on their decimal fractions.

    Installation

    npm i ccunits

    Usage

    const ccunits = require('ccunits');
    OR
    import { toMinimal, fromMinimal, formatted } from 'ccunits'

    Format input number by cryptocurrency decimal precision

    const formatted = require('ccunits').formatted;
    OR
    import { formatted } from 'ccunits'
     
    formatted('0.6789853354', 5) // '0.67898'

    Convert to minimal unit

    const toMinimal = require('ccunits').toMinimal
    OR
    import { toMinimal } from 'ccunits'
     
    toMinimal('0.0066752', 18) // '6675200000000000'

    Convert from minimal unit

    const fromMinimal = require('ccunits').fromMinimal
    OR
    import { fromMinimal } from 'ccunits'
     
    fromMinimal('100546675200000000', 18) // '0.1005466752'

    License

    MIT

    Install

    npm i ccunits

    DownloadsWeekly Downloads

    8

    Version

    1.0.6

    License

    MIT

    Unpacked Size

    200 kB

    Total Files

    12

    Last publish

    Collaborators

    • avatar