New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

satoshi-rpgcoin

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

satoshi-rpgcoin

Convert Satoshi <-> Rpgcoin

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

satoshi-rpgcoin

npm module to convert between Satoshi and Rpgcoin with lightweight precision.



Install

npm install --save satoshi-rpgcoin

Usage

Node.js

var sb = require('satoshi-rpgcoin');

sb.toSatoshi(1);
//=>100000000

sb.toRpgcoin(100000000);
//=>1

Web

<script src="https://rawgit.com/RPGCoin/satoshi-rpgcoin/master/index.bundle.js"></script>
<script>
  console.log('One Satoshi equals ' + sb.toRpgcoin(1) + ' Rpgcoin');
</script>

Or download it with npm install --save satoshi-rpgcoin and reference it as:

<script src="node_modules/satoshi-rpgcoin/index.bundle.js"></script>

Error Handling

try {
  sb.toSatoshi(false)); //Throws TypeError
} catch (err) {
  console.log(err);
}

API

sb.toSatoshi(number || string)
sb.toRpgcoin(number || string)

Read more on the Wiki


FAQ

  • What is a Satoshi?

    • Satoshi is to Rpgcoin as pennies are to the dollar. Except that there are 100,000,000 Satoshi in one Rpgcoin.
  • Why do I need a module when I can just divide or multiply by 100,000,000?

    • See here - Floating point errors are a bitch. So satoshi-rpgcoin uses a bignum library to ensure accurate conversions!

Tests

npm test

License

MIT ©

Keywords

rpgcoin

FAQs

Package last updated on 17 Feb 2019

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