read-vietnamese-number
Version:
Convert numbers to text in Vietnamese
43 lines (42 loc) • 1.15 kB
TypeScript
export type Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
export type Period = [Digit, Digit, Digit];
export type InputNumber = string | bigint;
export interface NumberData {
isNegative: boolean;
integralPart: Period[];
fractionalPart: Digit[];
}
/**
* The base error class for all errors in the library.
*/
export declare class ReadVietnameseNumberError extends Error {
}
/**
* The error class used when the input number is invalid.
*/
export declare class InvalidNumberError extends ReadVietnameseNumberError {
}
/**
* The reading configuration class containing default options for reading numbers.
*/
export declare class ReadingConfig {
static readonly PERIOD_SIZE = 3;
static readonly FILLED_DIGIT = "0";
negativeSign: string;
pointSign: string;
thousandSign: string;
separator: string;
unit: string[];
units: string[][];
digits: string[];
negativeText: string;
pointText: string;
oddText: string;
tenText: string;
hundredText: string;
oneToneText: string;
fourToneText: string;
fiveToneText: string;
tenToneText: string;
skipTenTone: boolean;
}