@ce1pers/use-number
v1.0.0
Published
Collection of useful numeric helper functions.
Downloads
3
Maintainers
Readme
@ce1pers/use-number
Provide various useful numeric helper functions.
Installation
npm
npm i @ce1pers/use-number
yarn
yarn add @ce1pers/use-number
Usage
// Import library.
import {
decimalToHex,
decimalToBinary,
decimalToOctal,
binaryToDecimal,
binaryToHex,
binaryToOctal,
hexToBinary,
hexToDecimal,
hexToOctal,
} from "@ce1pers/use-number";
console.log(decimalToHex(10)); // 'a'
console.log(decimalToBinary(10)); // '1010'
console.log(decimalToOctal(10)); // '12'
console.log(binaryToDecimal("0010")); // 2
console.log(binaryToHex("1010")); // 'a'
console.log(binaryToOctal("1000")); // '10'
console.log(hexToBinary("a")); // '1010'
console.log(hexToDecimal("a")); // 10
console.log(hexToOctal("a")); // '12'