n2words
Version:
Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.
47 lines (46 loc) • 1.95 kB
TypeScript
/**
* Kannada (India) language converter
*
* CLDR: kn-IN | Kannada as used in India
*
* Key features:
* - Indian numbering system (ಸಾವಿರ, ಲಕ್ಷ, ಕೋಟಿ)
* - Kannada script
* - 3-2-2 grouping pattern (last 3 digits, then groups of 2)
* - Complete word forms for 0-99
* - Per-digit decimal reading
*/
export declare const cardinalMax: bigint;
export declare const ordinalMax: bigint;
export declare const currencyMax: bigint;
/**
* Converts a numeric value to Kannada words.
* @param {number | string | bigint} value - The numeric value to convert
* @returns {string} The number in Kannada words
*/
declare function toCardinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Kannada 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 Kannada currency words (Indian Rupee).
* @param {number | string | bigint} value - The currency amount to convert
* @returns {string} The amount in Kannada 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 };