n2words
Version:
Convert numbers to words in 70+ languages with zero dependencies. Supports BigInt, decimals, and browser/Node.js environments.
72 lines (71 loc) • 2.91 kB
TypeScript
/**
* Lithuanian (Lithuania) language converter
*
* CLDR: lt-LT | Lithuanian as used in Lithuania
*
* Key features:
* - Three-form pluralization (singular/plural/genitive)
* - Gender agreement (masculine/feminine for numbers < 1000)
* - Two-form hundreds (šimtas/šimtai)
* - Long scale naming
*/
export declare const cardinalMax: bigint;
export declare const ordinalMax: bigint;
export declare const currencyMax: bigint;
export type CardinalOptions = {
/**
* - Gender for numbers < 1000
*/
gender?: ('masculine' | 'feminine');
};
/**
* @typedef {object} CardinalOptions
* @property {('masculine'|'feminine')} [gender] - Gender for numbers < 1000
*/
/** @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 Lithuanian words.
* @param {number | string | bigint} value - The numeric value to convert
* @param {CardinalOptions} [options] - Conversion options
* @returns {string} The number in Lithuanian words
* @throws {TypeError} If value is not a valid numeric type
* @throws {Error} If value is not a valid number format
* @example
* toCardinal(42) // 'keturiasdešimt du'
* toCardinal(1, { gender: 'feminine' }) // 'viena'
* toCardinal(1000000) // 'vienas milijonas'
*/
declare function toCardinal(value: number | string | bigint, options?: CardinalOptions): string;
/**
* Converts a numeric value to Lithuanian 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) // 'pirmas'
* toOrdinal(2) // 'antras'
* toOrdinal(21) // 'dvidešimt pirmas'
* toOrdinal(100) // 'šimtasis'
* toOrdinal(1000) // 'tūkstantasis'
*/
declare function toOrdinal(value: number | string | bigint): string;
/**
* Converts a numeric value to Lithuanian currency words (Euro).
* @param {number | string | bigint} value - The currency amount to convert
* @returns {string} The amount in Lithuanian 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) // 'keturiasdešimt du eurai'
* toCurrency(1) // 'vienas euras'
* toCurrency(1.50) // 'vienas euras penkiasdešimt centų'
* toCurrency(-5) // 'minus penki eurai'
*/
declare function toCurrency(value: number | string | bigint): string;
export { toCardinal, toOrdinal, toCurrency };