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.81 kB
TypeScript
/**
* Swahili (Kenya) language converter
*
* CLDR: sw-KE | Swahili as used in Kenya
*
* Key features:
* - "na" connector for compound numbers
* - Reversed hundreds: "mia moja" (one hundred)
* - Scale words: elfu, milioni, bilioni
*/
export declare const cardinalMax: bigint;
export declare const ordinalMax: bigint;
export declare const currencyMax: bigint;
/**
* Converts a numeric value to Swahili words.
* @param {number | string | bigint} value - The numeric value to convert
* @returns {string} The number in Swahili words
*/
declare function toCardinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Swahili 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) // 'wa kwanza'
* toOrdinal(2) // 'wa pili'
* toOrdinal(10) // 'wa kumi'
*/
declare function toOrdinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Swahili currency words (Kenyan Shilling).
*
* Uses shilingi and senti (100 senti = 1 shilingi).
* @param {number | string | bigint} value - The currency amount to convert
* @returns {string} The amount in Swahili 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) // 'shilingi arobaini na mbili'
* toCurrency(1.50) // 'shilingi moja na senti hamsini'
* toCurrency(-5) // 'minus shilingi tano'
*/
declare function toCurrency(value: number | string | bigint): string;
export { toCardinal, toOrdinal, toCurrency };