n2words
Version:
Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.
51 lines (50 loc) • 2.03 kB
TypeScript
/**
* Hausa (Nigeria) language converter
*
* CLDR: ha-NG | Hausa as used in Nigeria
*
* Key features:
* - Authentic Boko orthography with ɗ (hooked d) and ' (glottal stop)
* - Teens with "sha" prefix (sha ɗaya = 11)
* - Compound numbers with "da" connector (ashirin da ɗaya = 21)
* - Arabic loanwords for tens (ashirin, talatin, arba'in, etc.)
* - Reversed multiplier order: "biyu ɗari" (200), "biyu dubu" (2000)
* - Implicit one before ɗari and dubu
* - Per-digit decimal reading
*/
export declare const cardinalMax: bigint;
export declare const ordinalMax: bigint;
export declare const currencyMax: bigint;
/**
* Converts a numeric value to Hausa words.
* @param {number | string | bigint} value - The numeric value to convert
* @returns {string} The number in Hausa words
*/
declare function toCardinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Hausa 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) // 'na farko'
* toOrdinal(2) // 'na biyu'
* toOrdinal(10) // 'na goma'
*/
declare function toOrdinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Hausa currency words (Nigerian Naira).
*
* Uses naira and kobo (100 kobo = 1 naira).
* @param {number | string | bigint} value - The currency amount to convert
* @returns {string} The amount in Hausa 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) // 'arba'in da biyu naira'
* toCurrency(1.50) // 'ɗaya naira da hamsin kobo'
* toCurrency(-5) // 'babu biyar naira'
*/
declare function toCurrency(value: number | string | bigint): string;
export { toCardinal, toOrdinal, toCurrency };