n2words
Version:
Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.
57 lines (56 loc) • 2.28 kB
TypeScript
/**
* Finnish (Finland) language converter
*
* CLDR: fi-FI | Finnish as used in Finland
*
* Key features:
* - Compound tens+ones without spaces: "kaksikymmentäyksi" (21)
* - Teens with "-toista" suffix
* - Omit "yksi" before sata/tuhat but keep before miljoona+
* - Long scale: miljoona, miljardi, biljoona
* - Per-digit decimal reading
*/
export declare const cardinalMax: bigint;
export declare const ordinalMax: bigint;
export declare const currencyMax: bigint;
/**
* Converts a numeric value to Finnish words.
* @param {number | string | bigint} value - The numeric value to convert
* @returns {string} The number in Finnish words
* @throws {TypeError} If value is not a valid numeric type
* @throws {Error} If value is not a valid number format
* @example
* toCardinal(21) // 'kaksikymmentäyksi'
* toCardinal(1000) // 'tuhat'
* toCardinal('3.14') // 'kolme pilkku yksi neljä'
*/
declare function toCardinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Finnish 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) // 'ensimmäinen'
* toOrdinal(2) // 'toinen'
* toOrdinal(3) // 'kolmas'
* toOrdinal(10) // 'kymmenes'
*/
declare function toOrdinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Finnish currency words (Euro).
*
* Euro uses sentti as subunit (100 senttiä = 1 euro).
* Finnish has singular/plural: 1 euro vs 2 euroa, 1 sentti vs 2 senttiä.
* @param {number | string | bigint} value - The currency amount to convert
* @returns {string} The amount in Finnish currency words
* @throws {TypeError} If value is not a valid numeric type
* @throws {Error} If value is not a valid number format
* @example
* toCurrency(1) // 'yksi euro'
* toCurrency(42) // 'neljäkymmentäkaksi euroa'
* toCurrency(1.50) // 'yksi euro viisikymmentä senttiä'
*/
declare function toCurrency(value: number | string | bigint): string;
export { toCardinal, toOrdinal, toCurrency };