convert-any-base
v1.0.2
Published
An easy-to-use base converter
Downloads
2
Maintainers
Readme
convert-any-base
An easy-to-use base converter
Installation
npm install convert-any-base
- to just install the package
npm install convert-any-base --save
- to add the package directly to your package.jsom
Examples
var convert = require('convert-any-base');
let decimalNumber = 2634; // 2634
console.log(convert.decToBin(decimalNumber)); // 101001001010
console.log(convert.decToOct(decimalNumber)); // 5112
console.log(convert.decToHex(decimalNumber)); // a4a
var convert = require('convert-any-base');
let baseSevenNumber = 143; // 143
console.log(convert.customConversion(baseSevenNumber, 7, 13)); // 62
Methods
- binToOct(number)
- binToDec(number)
- binToHex(number)
- octToBin(number)
- octToDec(number)
- octToHex(number)
- decToBin(number)
- decToOct(number)
- decToHex(number)
- hexToBin(number)
- hexToOct(number)
- hexToDec(number)
- customConversion(number, currentBase, targetBase)
License
Licensed under MIT. See LICENSE for more information.
Created by Mark Amirkan