Enables language-sensitive number formatting. Wraps Intl.NumberFormat

Constructors

Methods

  • Formats a number according to the locale and formatting options of this NumberFormat object

    Parameters

    • value: number | bigint

      Number or BigInt to format

    Returns string

    String representing the given number formatted according to the locale and formatting options of this NumberFormat object

  • Formats a range of numbers according to the locale and formatting options of this NumberFormat object

    Parameters

    • startRange: number | bigint

      Number or bigint representing the start of the range

    • endRange: number | bigint

      Number or bigint representing the end of the range

    Returns string

    String representing the given range of numbers formatted according to the locale and formatting options of this NumberFormat object

  • Returns an array of objects containing the locale-specific tokens from which it is possible to build custom strings while preserving the locale-specific parts.

    Parameters

    • startRange: number | bigint

      Number or bigint representing start of the range

    • endRange: number | bigint

      Number or bigint representing end of the range

    Returns NumberRangeFormatPart[]

    Array of NumberRangeFormatPart objects containing the formatted range of numbers in parts

  • Allows locale-aware formatting of strings produced by this NumberFormat object

    Parameters

    • value: number | bigint

      Number or bigint to format

    Returns NumberFormatPart[]

    Array of NumberFormatPart objects containing the formatted number in parts

  • Returns a new object with properties reflecting the locale and number formatting options computed during initialization of this NumberFormat object

    Returns ResolvedNumberFormatOptions

    ResolvedNumberFormatOptions object