satoshi-ravencoin

1.0.0 • Public • Published

satoshi-ravencoin

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



Install

npm install --save satoshi-ravencoin

Usage

Node.js

var sb = require('satoshi-ravencoin');
 
sb.toSatoshi(1);
//=>100000000
 
sb.toRavencoin(100000000);
//=>1

Web

<script src="https://rawgit.com/raven-community/satoshi-ravencoin/master/index.bundle.js"></script>
<script>
  console.log('One Satoshi equals ' + sb.toRavencoin(1) + ' Ravencoin');
</script>

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

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

Error Handling

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

API

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

Read more on the Wiki


FAQ

  • What is a Satoshi?

    • Satoshi is to Ravencoin as pennies are to the dollar. Except that there are 100,000,000 Satoshi in one Ravencoin.
  • 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-ravencoin uses a bignum library to ensure accurate conversions!

Tests

npm test

License

MIT ©

Package Sidebar

Install

npm i satoshi-ravencoin

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

38.5 kB

Total Files

5

Last publish

Collaborators

  • msftserver