spell-vn-number
Version:
Vietnamese number speller
40 lines (39 loc) • 1.73 kB
TypeScript
import { InputNumber, NormalizeOptions, SpellerConfig } from './types';
/**
* Validates an input number, ensures it's a valid string representation.
* @param input The input number to validate
* @param config NormalizeOptions
* @returns A valid string representation of the number
*/
export declare function cleanInputNumber(input: InputNumber, config: NormalizeOptions): string;
/**
* Normalizes a number string by cleaning whitespace and special characters.
* Compatible with IE11 and older browsers.
* @param input The string to normalize
* @param options Options for normalization
* @returns Normalized number string
*/
export declare function normalizeNumberString(input: string, options?: NormalizeOptions): string;
/**
* Removes leading zeros from a string
* @param str The input string
* @param char The character to trim (default '0')
* @returns The string with leading chars removed
*/
export declare function trimLeft(str: string, char?: string): string;
/**
* Removes trailing zeros from a string
* @param str The input string
* @param char The character to trim (default '0')
* @returns The string with trailing chars removed
*/
export declare function trimRight(str: string, char?: string): string;
/**
* Trims redundant zeros at the beginning and end of a number string with configurable behavior
* For integral part: trims leading zeros but always keeps at least one if at start
* For fractional part: trims trailing zeros with configurable behavior
* @param config Configuration object with trim settings
* @param numberStr The number string to process
* @returns The trimmed number string
*/
export declare function handleRedundantZeros(config: SpellerConfig, numberStr: string): string;