@technobuddha/library
Version:
A large library of useful functions
16 lines (15 loc) • 780 B
TypeScript
import { type Numbering } from './numbering.ts';
/**
* Converts a number less than 1000 into its English words representation as an array of strings.
* @param input - The number to convert (should be in the range 0 to 999).
* @param options - An object specifying formatting options:
* - and: A string to insert between hundreds and the remainder (e.g., "and" in "one hundred and one").
* - hyphen: A string to use as a hyphen between tens and ones (defaults to a space).
* @returns An array of strings representing the number in words.
* @example
* ```typescript
* hundreds(342, \{ and: "and", hyphen: "-" \}); // ["three", "hundred", "and", "forty-two"]
* ```
* @internal
*/
export declare function hundreds(input: number, { and, hyphen }: Numbering): string[];