Convert any decimal number to any other Numeral System. Support user's alphabet.
npm install decimal-to-any
Convert 256 decimal number to hex
``javascript`
var decToAny = require('decimal-to-any');
decToAny(256, 16); // '100'
Convert 100 decimal number to base 6 numeral system
`javascript`
decToAny(100, 6); // '244'`
Convert 200.1 decimal number to base 30 numeral systemjavascript`
decToAny(200.1, 30); // '6k.3'
Convert 20 decimal number to binary
`javascript`
decToAny(20, 2); // '10100'
#### number
Type: Number, String
The decimal number for convert. 100, 100.1, "100.1"
#### numeralSystem
Type: Number
The numeral system for output.
#### options
Type: Object
##### options.alphabet
Type: Array, String "0123456789abcdefghijklmnopqrstuvwxyz"
Default:
Alternative alphabet for output.
`javascript
var options = {
alphabet: '!@#$%^&*()_+={}<>±'
};
decToAny(100, 16, options)// '&%'
decToAny(200.002, 16, options)// '=(.!!($@#&})*({%<}'
`
Example for understanding. DEC to DEC with user's alphabet. It's just example. It's better to use here String.replace :)`javascript
var options = {
alphabet: '@123456789'// 'at' symbol instead of 0
};
decToAny(100, 10, options)// '1@@'
`
Important: if you want to use numeral system with base higher than the default alphabet length (example: base 50), you should define new alphabet via options.alphabet.
##### options.precision
Type: Number`
Default: 20
Quantity of numbers after point
[npm-url]: https://npmjs.org/package/decimal-to-any
[npm-image]: https://img.shields.io/npm/v/decimal-to-any.svg