Skip to content

@technobuddha > library > Math > Verbalization

Type Alias: Numbering

ts
type Numbering = {
  and: string;
  denominators: "common" | "wrench" | number[];
  hyphen: string;
  ordinal: boolean;
  output: {
     fraction: "numeric" | "alphabetic";
     integer: "numeric" | "alphabetic" | "hybrid";
  };
  precision: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
  shift: false | "decimal" | "fraction";
  tolerance: number;
};

Defined in: numbering.ts:14

Options for controlling how numbers are converted to words or symbols.

Properties

PropertyTypeDescriptionDefined in
andstringWord to place after the hundreds. E.g., "one hundred and one" vs. "one hundred one"src/numbering.ts:29
denominators"common" | "wrench" | number[]Allowed denominators for fractions. - 'common': typical denominators (2, 3, 4, etc.) - 'wrench': denominators used in wrench sizes - number[]: custom denominatorssrc/numbering.ts:43
hyphenstringCharacter to place between the tens and ones units. E.g., "twenty-one" vs. "twenty one"src/numbering.ts:32
ordinalbooleanWhether to use ordinal form (e.g., "first", "second", "third").src/numbering.ts:49
output{ fraction: "numeric" | "alphabetic"; integer: "numeric" | "alphabetic" | "hybrid"; }Output format for integer and fraction parts. - integer: 'numeric''alphabetic'
output.fraction"numeric" | "alphabetic"fraction output format: 'numeric' or 'alphabetic'src/numbering.ts:25
output.integer"numeric" | "alphabetic" | "hybrid"integer output format: 'numeric', 'alphabetic', or 'hybrid'src/numbering.ts:22
precision1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9Number of decimal places or significant digits to use (1-9).src/numbering.ts:46
shiftfalse | "decimal" | "fraction"Whether to shift the output. - false: no shift - 'decimal': shift decimal part - 'fraction': shift fraction partsrc/numbering.ts:57
tolerancenumberMaximum allowed difference between the actual and represented value.src/numbering.ts:35