n2words
Version:
Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.
52 lines (51 loc) • 2.05 kB
TypeScript
/**
* Amharic (Ethiopia) language converter
*
* CLDR: am-ET | Amharic as used in Ethiopia (Ge'ez script)
*
* Key features:
* - Ge'ez/Ethiopic script numerals
* - Teens formed with "አስራ" prefix
* - Keeps "one" before hundred: "አንድ መቶ" (100)
* - Short scale naming
* - Per-digit decimal reading
*/
export declare const cardinalMax: bigint;
export declare const ordinalMax: bigint;
export declare const currencyMax: bigint;
/**
* Converts a numeric value to Amharic words.
* @param {number | string | bigint} value - The numeric value to convert
* @returns {string} The number in Amharic words
*/
declare function toCardinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Amharic ordinal words.
*
* Amharic ordinals: add -ኛ suffix to cardinal.
* Special case: 1 → አንደኛ
* @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) // 'አስርኛ'
* toOrdinal(100) // 'አንድ መቶኛ'
*/
declare function toOrdinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Amharic currency words (Ethiopian Birr).
* @param {number | string | bigint} value - The currency amount to convert
* @returns {string} The amount in Amharic 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.99) // 'ዘጠና ዘጠኝ ሳንቲም'
* toCurrency(0.01) // 'አንድ ሳንቲም'
*/
declare function toCurrency(value: number | string | bigint): string;
export { toCardinal, toOrdinal, toCurrency };