n2words
Version:
Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.
55 lines (54 loc) • 2.15 kB
TypeScript
/**
* Danish (Denmark) language converter
*
* CLDR: da-DK | Danish as used in Denmark
*
* Key features:
* - Vigesimal (base-20) tens naming: halvtreds (50), treds (60), etc.
* - Units-before-tens: "enogtyve" (21) = one-and-twenty
* - Compound thousands: "ettusind", "firetusinde"
* - "og" conjunction after hundreds and thousands
* - Long scale for millions+
*/
export declare const cardinalMax: bigint;
export declare const ordinalMax: bigint;
export declare const currencyMax: bigint;
/**
* Converts a numeric value to Danish words.
* @param {number | string | bigint} value - The numeric value to convert
* @returns {string} The number in Danish words
* @throws {TypeError} If value is not a valid numeric type
* @throws {Error} If value is not a valid number format
* @example
* toCardinal(21) // 'enogtyve'
* toCardinal(1000) // 'ettusind'
* toCardinal(1000000) // 'en millioner'
*/
declare function toCardinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Danish 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) // 'første'
* toOrdinal(2) // 'anden'
* toOrdinal(21) // 'enogtyvede'
*/
declare function toOrdinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Danish currency words (Danish Krone).
*
* Uses krone/kroner and øre (100 øre = 1 krone).
* @param {number | string | bigint} value - The currency amount to convert
* @returns {string} The amount in Danish 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) // 'en krone'
* toCurrency(42) // 'toogfyrre kroner'
* toCurrency(1.50) // 'en krone og halvtreds øre'
*/
declare function toCurrency(value: number | string | bigint): string;
export { toCardinal, toOrdinal, toCurrency };