项目作者: Luc4sguilherme

项目描述 :
Numeric base converter
高级语言: TypeScript
项目地址: git://github.com/Luc4sguilherme/baseNConverter.git
创建时间: 2021-02-14T03:38:17Z
项目社区:https://github.com/Luc4sguilherme/baseNConverter

开源协议:MIT License

下载


Usage

Binary to Decimal

  1. import Converter from '../src/index';
  2. const binToDec = new Converter(2, 10);
  3. console.log(binToDec.convert('1111')); // '15'

Binary to Hexadecimal

  1. import Converter from '../src/index';
  2. const binToHex = new Converter('binary', 'hexadecimal');
  3. console.log(binToHex.convert('1111')); // 'F'

Binary to Octal

  1. import Converter from '../src/index';
  2. const binToOctal = new Converter('bin', 8);
  3. console.log(binToOctal.convert('1111')); // '17'

Binary to Hexatrigesimal

  1. import Converter from '../src/index';
  2. const binToHexatri = new Converter(2, 'hexatrige');
  3. console.log(binToHexatri.convert('100011')); // 'Z'

Decimal to Hexadecimal

  1. import Converter from '../src/index';
  2. const decToHex = new Converter(10, 16);
  3. console.log(decToHex.convert('10')); // 'A'

Octal to Decimal

  1. import Converter from '../src/index';
  2. const octalToDec = new Converter('octal', 'decimal');
  3. console.log(octalToDec.convert('10')); // '8'

Run tests

  1. npm run test

Author

👤 Lucas Guilherme

📝 License

Copyright © 2021 Lucas Guilherme.

This project is MIT licensed.