Number
The Number category supports conversions between number bases such as binary, octal, decimal, and hexadecimal.
Supported Bases
Section titled “Supported Bases”- binary
base 2 - octal
base 8 - decimal
base 10 - hexadecimal
base 16
Quick Example
Section titled “Quick Example”import { Conversion } from "@devhaven/unit-conversion";
const convert = new Conversion();
convert.value(255).from("decimal").to("hexadecimal")convert.value(1010).from("binary").to("decimal")Common Conversions
Section titled “Common Conversions”Binary ↔ Decimal
Section titled “Binary ↔ Decimal”convert.value(10).from("decimal").to("binary");convert.value(10).from("binary").to("decimal");Decimal ↔ Hexadecimal
Section titled “Decimal ↔ Hexadecimal”convert.value("a").from("hexadecimal").to("decimal");convert.value(15).from("decimal").to("hexadecimal");Octal ↔ Decimal
Section titled “Octal ↔ Decimal”convert.value(77).from("octal").to("decimal");convert.value(77).from("decimal").to("octal");