errors-base
v1.0.1
Published
A tool to help with encoding and decoding different radius' of various bases.
Downloads
3
Readme
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" ]);
// ...