@altostra/core
Version:
Core library for shared types and logic
27 lines (26 loc) • 923 B
TypeScript
import type { Alphabet } from "../common";
/** Parameters of `MappedAlphabet` */
export interface MappedAlphabetParams {
/**
* Alphabet that serves as the base alphabet
*/
base: Alphabet;
/**
* An object that maps characters to replacement characters
*/
mapping: Record<string, string>;
}
/**
* An alphabet that maps specified characters in a base alphabet to replacement characters
*/
export declare abstract class MappedAlphabetBase implements Alphabet {
protected readonly _base: Alphabet;
protected readonly _mapping: Record<string, string>;
protected readonly _reverseMapping: Record<string, string>;
constructor({ base, mapping, }: MappedAlphabetParams);
get length(): number;
abstract has(char: string): boolean;
abstract getAt(index: number): string;
abstract indexOf(char: string): number;
abstract [Symbol.iterator](): Iterator<string>;
}