@betafcc/base-converter
v0.0.2
Published
Arbitrary-base number converter
Downloads
1
Readme
base-converter
An any-base integer converter
Install
npm install @betafcc/base-converter
Usage
Chosse any from
and to
base alphabet
import bc from '@betafcc/base-converter';
const decToBin = bc
.from('0123456789')
.to('01')
decToBin('2'); // '10'
Really, any base
const toAlpha = bc.to('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
toAlpha.from('0123456789')('100'); // 'DW'
toAlpha.from('0123456789abcdef')('-100'); // '-JW'
Non integers and more options support soon