npm.io
0.0.2 • Published 9 years ago

@betafcc/base-converter

Licence
MIT
Version
0.0.2
Deps
0
Vulns
0
Weekly
0

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

Keywords