n2words
Version:
Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.
60 lines (59 loc) • 2.5 kB
TypeScript
/**
* Czech (Czechia) language converter
*
* CLDR: cs-CZ | Czech as used in Czechia
*
* Czech-specific rules:
* - Three-form pluralization: 1 = singular, 2-4 = few, 5+ = many
* - Irregular hundreds: sto, dvě stě, tři sta, čtyři sta, pět set...
* - Gender: dva (masc) vs dvě (fem) for 2
* - Omit "one" before scale words: "tisíc" not "jedna tisíc"
* - Dynamic decimal separator: celá/celé/celých based on integer
*/
export declare const cardinalMax: bigint;
export declare const ordinalMax: bigint;
export declare const currencyMax: bigint;
/**
* Converts a numeric value to Czech words.
*
* This is the main public API. It accepts any valid numeric input
* (number, string, or bigint) and handles parsing internally.
* @param {number | string | bigint} value - The numeric value to convert
* @returns {string} The number in Czech words
* @throws {TypeError} If value is not a valid numeric type
* @throws {Error} If value is not a valid number format
* @example
* toCardinal(21) // 'dvacet jedna'
* toCardinal(1000) // 'tisíc'
* toCardinal(2000) // 'dva tisíce'
* toCardinal(5000) // 'pět tisíc'
*/
declare function toCardinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Czech ordinal words (masculine nominative).
* @param {number | string | bigint} value - The numeric value to convert (must be a 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) // 'první'
* toOrdinal(2) // 'druhý'
* toOrdinal(21) // 'dvacet první'
* toOrdinal(100) // 'stý'
* toOrdinal(1000) // 'tisící'
*/
declare function toOrdinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Czech currency words (Koruna).
* @param {number | string | bigint} value - The currency amount to convert
* @returns {string} The amount in Czech 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) // 'čtyřicet dva koruny'
* toCurrency(1) // 'jedna koruna'
* toCurrency(1.50) // 'jedna koruna padesát haléřů'
* toCurrency(-5) // 'mínus pět korun'
*/
declare function toCurrency(value: number | string | bigint): string;
export { toCardinal, toOrdinal, toCurrency };