n2words
Version:
Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.
67 lines (66 loc) • 2.56 kB
TypeScript
/**
* Romanian (Romania) language converter
*
* CLDR: ro-RO | Romanian as used in Romania
*
* Key features:
* - Gender agreement (unu/una, doi/două)
* - "De" preposition insertion for groups >= 20
* - Complex scale word handling (mie/mii, milion/milioane)
* - Feminine units for thousands
*/
export declare const cardinalMax: bigint;
export declare const ordinalMax: bigint;
export declare const currencyMax: bigint;
export type CardinalOptions = {
/**
* - Gender for numbers
*/
gender?: ('masculine' | 'feminine');
};
/**
* @typedef {object} CardinalOptions
* @property {('masculine'|'feminine')} [gender] - Gender for numbers
*/
/** @type {Required<CardinalOptions>} */
export declare const cardinalDefaults: Required<CardinalOptions>;
/** @type {{ gender: ReadonlyArray<Required<CardinalOptions>['gender']> }} */
export declare const cardinalValues: {
gender: ReadonlyArray<Required<CardinalOptions>['gender']>;
};
/**
* Converts a numeric value to Romanian words.
* @param {number | string | bigint} value - The numeric value to convert
* @param {CardinalOptions} [options] - Conversion options
* @returns {string} The number in Romanian words
* @throws {TypeError} If value is not a valid numeric type
* @throws {Error} If value is not a valid number format
* @example
* toCardinal(21) // 'douăzeci și unu'
* toCardinal(1, { gender: 'feminine' }) // 'una'
* toCardinal(1000) // 'o mie'
*/
declare function toCardinal(value: number | string | bigint, options?: CardinalOptions): string;
/**
* Converts a numeric value to Romanian ordinal words.
* @param {number | string | bigint} value - The numeric value to convert
* @returns {string} The ordinal in Romanian words
* @throws {TypeError} If value is not a valid numeric type
* @throws {Error} If value is not a positive integer
* @example
* toOrdinal(1) // 'primul'
* toOrdinal(21) // 'douăzeci și primul'
*/
declare function toOrdinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Romanian Leu currency words.
* @param {number | string | bigint} value - The numeric value to convert
* @returns {string} The currency in Romanian words
* @throws {TypeError} If value is not a valid numeric type
* @throws {Error} If value is not a valid number format
* @example
* toCurrency(1) // 'un leu'
* toCurrency(2.50) // 'doi lei cincizeci de bani'
*/
declare function toCurrency(value: number | string | bigint): string;
export { toCardinal, toOrdinal, toCurrency };