sm-simple-converter

Convert between bases

Usage no npm install needed!

<script type="module">
  import smSimpleConverter from 'https://cdn.skypack.dev/sm-simple-converter';
</script>

README


Logo

SimpleConverter is a simple JS library for Converting between Bases.

Installation

Use the package manager npm to install SimpleConverter.

npm install sm-simple-converter

Usage

let base = require("sm-simple-converter");

console.log(base.decToBin(123)); // 1111011
console.log(base.decToCustom(123, 2)); // 1111011
console.log(base.binaryToDec("1111011")); // 123
console.log(base.hexToDec("dada")); // 56026
console.log(base.customToDec("1111011", 2)); // 123
  • decToBin(str)
  • decToHex(str)
  • decToOct(str)
  • decToCustom(str, base)
  • binaryToDec(str)
  • hexToDec(str)
  • octToDec(str)
  • customToDec(str, base)

License

MIT