Skip to content

Luc4sguilherme/baseNConverter

Repository files navigation

Usage

Binary to Decimal

import Converter from '../src/index';

const binToDec = new Converter(2, 10);

console.log(binToDec.convert('1111')); // '15'

Binary to Hexadecimal

import Converter from '../src/index';

const binToHex = new Converter('binary', 'hexadecimal');

console.log(binToHex.convert('1111')); // 'F'

Binary to Octal

import Converter from '../src/index';

const binToOctal = new Converter('bin', 8);

console.log(binToOctal.convert('1111')); // '17'

Binary to Hexatrigesimal

import Converter from '../src/index';

const binToHexatri = new Converter(2, 'hexatrige');

console.log(binToHexatri.convert('100011')); // 'Z'

Decimal to Hexadecimal

import Converter from '../src/index';

const decToHex = new Converter(10, 16);

console.log(decToHex.convert('10')); // 'A'

Octal to Decimal

import Converter from '../src/index';

const octalToDec = new Converter('octal', 'decimal');

console.log(octalToDec.convert('10')); // '8'

Run tests

npm run test

Author

👤 Lucas Guilherme

📝 License

Copyright © 2021 Lucas Guilherme.

This project is MIT licensed.