UNPKG

polish-number-to-words

Version:

Spell numbers using words in Polish | Napisz liczbę słownie po polsku

32 lines (31 loc) 1.27 kB
/** * Options for customizing the number-to-words conversion in Polish. */ export interface NumberToWordsOptions { /** * If true, use the informal form of fractional numbers (e.g., "pół" instead of "jedna druga"). */ informalFraction?: boolean; /** * Maximum number (inclusive) for which individual digits are used in informal fractions (e.g., "trzy czwarte"). * Only relevant if `informalFraction` is true. */ informalFractionFormIndividualNumberThreshold?: number; /** * If true, attempt to simplify fractions (e.g., 2/4 becomes 1/2). */ simplifyFraction?: boolean; /** * If true, allow the use of single-word fractional forms where applicable (e.g., "półtorej", "ćwierć"). */ useSingleWordFractions?: boolean; } /** * Converts a number into its Polish word form. * Handles integers, fractions, and combinations, with support for informal forms and custom options. * * @param num The number to convert (e.g., 123, 0.5, 2.25, -1). * @param options Optional settings to control formatting behavior. * @returns The number expressed in Polish words. */ export declare function numberToWordsPL(num: number, options?: NumberToWordsOptions): string;