UNPKG

stringzy

Version:

A versatile string manipulation library providing a range of text utilities for JavaScript and Node.js applications.

20 lines (19 loc) 833 B
import { NumberToTextLanguage } from "./types"; /** * Converts a number to its text representation in the specified language. * * @param num - The number to convert (integer between -1,000,000,000,000 and 1,000,000,000,000) * @param lang - The target language ('en' for English, 'pl' for Polish) * @returns The text representation of the number * * @example * numberToText(123) // "one hundred twenty-three" * numberToText(123, 'pl') // "sto dwadzieścia trzy" * numberToText(-45) // "minus forty-five" * numberToText(1000000) // "one million" * numberToText(1000000, 'pl') // "milion" * * @throws {TypeError} If num is not a valid integer or lang is not supported * @throws {RangeError} If num is outside the supported range */ export declare function numberToText(num: number, lang?: NumberToTextLanguage): string;