Socket
Socket
Sign inDemoInstall

bigint-base

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bigint-base

Yet another base conversion library, but using BigInt.


Version published
Weekly downloads
4
increased by100%
Maintainers
1
Install size
12.3 kB
Created
Weekly downloads
 

Changelog

Source

0.1.4 (2023-06-10)

Bug Fixes

  • export src (27ed588)

Readme

Source

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

Keywords

FAQs

Last updated on 10 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc