0.0.2 • Published 7 years ago

@betafcc/base-converter v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

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