polish-number-to-words
Version:
Spell numbers using words in Polish | Napisz liczbę słownie po polsku
30 lines (29 loc) • 1.34 kB
TypeScript
/**
* Options for converting decimal fractions to words in Polish.
*/
export interface DecimalFractionToWordsOptions {
/**
* If true, use the informal "digit-by-digit" style (e.g., "przecinek jeden dwa trzy").
* Otherwise, express as a proper fraction (e.g., "trzy setne").
*/
informal?: boolean;
/**
* Maximum number of decimal digits (inclusive) for which to use full number words
* instead of digit-by-digit spelling in informal mode.
*/
informalFormIndividualNumberThreshold?: number;
/**
* Whether to simplify the fraction before converting it (e.g., 25/100 → 1/4).
*/
simplifyFraction?: boolean;
}
/**
* Converts a decimal fraction into Polish words.
* Can return either a full fractional phrase (e.g., "dwanaście tysięcznych") or a digit-by-digit form (e.g., "przecinek dwanaście"). Ignores the minus sign.
*
* @param num A non-integer number between 0 and 1 (e.g., 0.25, 0.125, etc.).
* @param options Optional settings to customize the output style.
* @throws Will throw if an integer is provided instead of a decimal fraction.
* @returns A string representing the decimal fraction in Polish, ignoring the minus.
*/
export declare function decimalFractionToWordsPL(num: number, options?: DecimalFractionToWordsOptions): string;