crypto-sn

1.0.3 • Public • Published

Discord server NPM version NPM downloads Patreon Ko-Fi

npm installnfo

Crypto-Simpler-Number

This project is to simplify cryptocurrency numbers to values more similar to fiat currency values. The complete example is present in the test.js file.

// Module
const cryptoSn = require('crypto-sn');

/* 

    Decimals = Crypto Decimals (Default: 18)
    Convert = Number of decimals to be removed (Default: 0)
    Value = Crypto Value (Default: 0)

    Symbol = The final result when the value is shown in a string
    fixed = toFixed() result

*/

// Bitcoin
console.log(cryptoSn({
    value: '1504050020000000000', 
    convert: 3,
    decimals: 18,
    symbol: '{N} BTC{R}',
    fixed: 2
}));

// BNB (Using Default Values)
console.log(cryptoSn({
    value: '2920020000000000', 
    convert: 3,
    symbol: '{N} BNB{R}',
    fixed: 2
}));

// SHIB (Using Default Values)
console.log(cryptoSn({
    value: '899280000000000000000000', 
    convert: -5,
    symbol: '{N} SHIB{R}',
    fixed: 4
}));

// LUNC (Using Default Values)
console.log(cryptoSn({
    value: '34925000000000000000000', 
    convert: -4,
    symbol: '{N} LUNC{R}',
    fixed: 6
}));

/* 

    Result

    1504.05 BTC³
    2.92 BNB³

    8.9928 SHIB⁻⁵
    3.492500 LUNC⁻⁴

*/

Package Sidebar

Install

npm i crypto-sn

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

9.46 kB

Total Files

7

Last publish

Collaborators

  • jasmindreasond