basepura
Version:
Basepura encoder and decoder in TypeScript
26 lines (25 loc) • 882 B
TypeScript
export declare const CHARS = "BCDGHJKLNPQRSTWZbcdghjklnpqrstwz";
export declare const REGEX: RegExp;
/**
* Encodes a non-negative bigint into a Basepura string.
*
* @param n - A non-negative bigint to encode
* @returns A Basepura string representation of the input number
* @throws {RangeError} If the input is negative
*/
export declare function encode(n: bigint): string;
/**
* Decodes a Basepura string into a bigint.
*
* @param s - A Basepura string to decode
* @returns The decoded bigint value
* @throws {RangeError} If the input is empty or contains invalid characters
*/
export declare function decode(s: string): bigint;
/**
* Checks if a string is a valid Basepura string.
*
* @param s - A string to validate
* @returns True if the string contains only valid Basepura characters, false otherwise
*/
export declare function isBasepura(s: string): boolean;