satoshi-ravencoin
v1.0.0
Published
Convert Satoshi <-> Ravencoin
Downloads
11
Maintainers
Readme
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)
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!
- See here - Floating point errors are a bitch. So
Tests
npm test
License
MIT ©