UNPKG

nhb-toolbox

Version:

A versatile collection of smart, efficient, and reusable utility functions and classes for everyday development needs.

30 lines 1.34 kB
import type { Numeric } from '../types/index'; /** * * Converts a numeric value into its corresponding English word representation. * @warning ***Supports numeric values up to `10e19` or `10^20` (one hundred quintillion).*** * @warning ***Decimal values are ignored; only the integer part is converted.*** * @param number - The number to convert into words. * @returns The number converted in words. */ export declare function numberToWords(num: Numeric): string; /** * * Converts a number to a Roman numeral. * @param num - The number to convert. Number must be `between 1 and 3999`. * @returns The Roman numeral representation. * * @example convertToRomanNumerals(29) → "XXIX" */ export declare const convertToRomanNumerals: (num: Numeric) => string; /** * * Converts a number, numeric string, or cardinal word string into its ordinal word representation. * * @param number - A number (e.g. `42`), numeric string (e.g. `"42"`), or cardinal word (e.g. `"forty-two"`). * @returns The ordinal word form (always in lowercase) of the input. * * @example * numberToWordsOrdinal(1); // "first" * numberToWordsOrdinal("23"); // "twenty-third" * numberToWordsOrdinal("twenty-three"); // "twenty-third" */ export declare function numberToWordsOrdinal(number: Numeric | string): string; //# sourceMappingURL=convert.d.ts.map