n2words
Version:
Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.
54 lines (53 loc) • 2.18 kB
TypeScript
/**
* Yoruba (Nigeria) language converter
*
* CLDR: yo-NG | Yoruba as used in Nigeria
*
* Yoruba uses a complex vigesimal (base-20) system with:
* - Additive patterns: 1-4 added to decade (lé = "plus")
* - Subtractive patterns: 5-9 subtracted from next decade (dín = "minus")
* - Odd decades (30,50,70,90) formed by subtracting 10 from next even decade
* - Even decades (20,40,60,80,100) are multiples of 20
*
* Examples:
* - 21 = ọ̀kan lé lógún (1 + 20)
* - 15 = àrùndínlógún (20 - 5)
* - 50 = àádọ́ta (60 - 10)
* - 45 = àrùndínláàádọ́ta (50 - 5)
*/
export declare const cardinalMax: null;
export declare const ordinalMax: null;
export declare const currencyMax: null;
/**
* Converts a numeric value to Yoruba words.
* @param {number | string | bigint} value - The numeric value to convert
* @returns {string} The number in Yoruba words
*/
declare function toCardinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Yoruba 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) // 'àkọ́kọ́'
* toOrdinal(2) // 'ìkejì'
* toOrdinal(3) // 'ìkẹẹ̀ta'
*/
declare function toOrdinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Yoruba currency words (Nigerian Naira).
*
* Uses náírà (naira) and kọ́bọ̀ (kobo).
* @param {number | string | bigint} value - The currency amount to convert
* @returns {string} The amount in Yoruba 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) // 'èjì lé lógójì náírà'
* toCurrency(1.50) // 'ọ̀kan náírà àti àádọ́ta kọ́bọ̀'
* toCurrency(-5) // 'àìní àrùn náírà'
*/
declare function toCurrency(value: number | string | bigint): string;
export { toCardinal, toOrdinal, toCurrency };