n2words
Version:
Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.
48 lines (47 loc) • 1.93 kB
TypeScript
/**
* Hindi (India) language converter
*
* CLDR: hi-IN | Hindi as used in India
*
* Key features:
* - Indian numbering system (हज़ार, लाख, करोड़)
* - Devanagari script
* - 3-2-2 grouping pattern (last 3 digits, then groups of 2)
* - Complete word forms for 0-99
* - 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 Hindi words.
* @param {number | string | bigint} value - The numeric value to convert
* @returns {string} The number in Hindi words
*/
declare function toCardinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Hindi 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(3) // 'तीसरा'
* toOrdinal(10) // 'दसवाँ'
*/
declare function toOrdinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Hindi currency words (Indian Rupee).
* @param {number | string | bigint} value - The currency amount to convert
* @returns {string} The amount in Hindi 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 };