n2words
Version:
Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.
49 lines (48 loc) • 2.04 kB
TypeScript
/**
* Tamil (India) language converter
*
* CLDR: ta-IN | Tamil as used in India
*
* Key features:
* - Indian numbering system (ஆயிரம், லட்சம், கோடி)
* - Tamil script
* - 3-2-2 grouping pattern
* - Complete word forms for 0-99
* - Special hundred word transformations (connected vs standalone)
* - Per-digit decimal reading
* - BigInt modulo for efficient segment extraction
*/
export declare const cardinalMax: bigint;
export declare const ordinalMax: bigint;
export declare const currencyMax: bigint;
/**
* Converts a numeric value to Tamil words.
* @param {number | string | bigint} value - The numeric value to convert
* @returns {string} The number in Tamil words
*/
declare function toCardinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Tamil ordinal words.
* @param {number | string | bigint} value - The numeric value to convert (positive integer)
* @returns {string} The number as ordinal words
* @throws {TypeError} If value is not a valid numeric type
* @throws {RangeError} If value is negative, zero, or has a decimal part
* @example
* toOrdinal(1) // 'முதல்'
* toOrdinal(2) // 'இரண்டாவது'
* toOrdinal(10) // 'பத்துஆவது'
*/
declare function toOrdinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Tamil currency words (Indian Rupee).
* @param {number | string | bigint} value - The currency amount to convert
* @returns {string} The amount in Tamil currency words
* @throws {TypeError} If value is not a valid numeric type
* @throws {Error} If value is not a valid number format
* @example
* toCurrency(42.50) // 'நாற்பத்திரண்டு ரூபாய் ஐம்பது பைசா'
* toCurrency(1) // 'ஒன்று ரூபாய்'
* toCurrency(0.01) // 'ஒன்று பைசா'
*/
declare function toCurrency(value: number | string | bigint): string;
export { toCardinal, toOrdinal, toCurrency };