0.1.4 • Published 11 months ago

bigint-base v0.1.4

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

bigint-base

Yet another base conversion library, but using BigInt.

Install

npm install --save bigint-base
# or
yarn add bigint-base

Usage

import { convertDecimalToBase, convertBaseToDecimal } from 'bigint-base'

const hex = '0123456789abcdef'

const decToHex = convertDecimalToBase(hex)
const hexToDec = convertBaseToDecimal(hex)

decToHex(16n) // '10'
hexToDec('10') // 16n

API

convertDecimalToBase

function convertDecimalToBase(alphabet: string, val: bigint): string
function convertDecimalToBase(alphabet: string): (val: bigint) => string

convertBaseToDecimal

function convertBaseToDecimal(alphabet: string, val: string): bigint
function convertBaseToDecimal(alphabet: string): (val: string) => bigint

convertBaseToBase

function convertBaseToBase(
  srcAlphabet: string
, destAlphabet: string
, val: string
): string
function convertBaseToBase(
  srcAlphabet: string
, destAlphabet: string
): (val: string) => string
0.1.4

11 months ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

3 years ago

0.1.0

3 years ago