n2words
Version:
Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.
66 lines (65 loc) • 2.48 kB
TypeScript
/**
* Turkish (Turkey) language converter
*
* CLDR: tr-TR | Turkish as used in Turkey
*
* Key features:
* - Omits 'bir' (one) before hundreds and thousands
* - Optional dropSpaces for compound form
* - Short scale naming
*/
export declare const cardinalMax: bigint;
export declare const ordinalMax: bigint;
export declare const currencyMax: bigint;
export type CardinalOptions = {
/**
* - Remove spaces for compound form
*/
dropSpaces?: boolean;
};
/**
* @typedef {object} CardinalOptions
* @property {boolean} [dropSpaces] - Remove spaces for compound form
*/
/** @type {Required<CardinalOptions>} */
export declare const cardinalDefaults: Required<CardinalOptions>;
/**
* Converts a numeric value to Turkish words.
* @param {number | string | bigint} value - The numeric value to convert
* @param {CardinalOptions} [options] - Conversion options
* @returns {string} The number in Turkish words
* @throws {TypeError} If value is not a valid numeric type
* @throws {Error} If value is not a valid number format
* @example
* toCardinal(21) // 'yirmi bir'
* toCardinal(21, { dropSpaces: true }) // 'yirmibir'
* toCardinal(1000) // 'bin'
*/
declare function toCardinal(value: number | string | bigint, options?: CardinalOptions): string;
/**
* Converts a numeric value to Turkish 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) // 'birinci'
* toOrdinal(2) // 'ikinci'
* toOrdinal(21) // 'yirmibirinci'
*/
declare function toOrdinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Turkish currency words (Turkish Lira).
*
* Uses lira and kuruş (100 kuruş = 1 lira).
* @param {number | string | bigint} value - The currency amount to convert
* @returns {string} The amount in Turkish 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) // 'kırk iki lira'
* toCurrency(1.50) // 'bir lira elli kuruş'
* toCurrency(-5) // 'eksi beş lira'
*/
declare function toCurrency(value: number | string | bigint): string;
export { toCardinal, toOrdinal, toCurrency };