errors-base

errors-base JS library on npm Download errors-base JS library

A tool to help with encoding and decoding different radius' of various bases.

Version 1.0.1 License UNLICENSED
errors-base has no homepage
errors-base JS library on GitHub
errors-base JS library on npm
Download errors-base JS library

errors-base

A tool to help with encoding and decoding different radius' of various bases.

By default Base uses Base62 alphabet.

Table of Contents

Installation

yarn add errors-base

Usage

import Base from "errors-base";
 
// Basic
Base.encode(999); // g7
Base.decode("g7"); // 999
 
// With decimals
Base.encode(999.999); // g7.g7
Base.decode("g7.g7"); // 999
 
// Negative numbers
Base.encode(-999); // -g7
Base.decode("-g7"); // -999
 
// Negative numbers with decimals
Base.encode(-999.999); // -g7.g7
Base.decode("-g7.g7"); // -999.999
 
// Custom alphabet
const base: Base = new Base([ "0", "1", "2", "3", "4", "5", "6", "7" ]);
 
// ...