A helper class for formatting and parsing numbers.

Hierarchy (view full)

Implements

Constructors

Properties

locale: string

The locale to use when formatting & parsing the number. If not specified, the current locale is used (see locale module).

Accessors

  • get currency(): string
  • The 3-letter ISO 4217 currency code (e.g "USD", "CAD"). Required when formatting a number using NumberFormat.CURRENCY or NumberFormat.ACCOUNTING.

    Returns string

  • set currency(currency): void
  • The 3-letter ISO 4217 currency code (e.g "USD", "CAD"). Required when formatting a number using NumberFormat.CURRENCY or NumberFormat.ACCOUNTING.

    Parameters

    • currency: string

    Returns void

  • get fractionalDigits(): number
  • The number of digits to show after the decimal point. If unspecified, an appropriate value is determined based on the locale and currency.

    Returns number

  • set fractionalDigits(fractionalDigits): void
  • The number of digits to show after the decimal point. If unspecified, an appropriate value is determined based on the locale and currency.

    Parameters

    • fractionalDigits: number

    Returns void

Methods

  • Sets the properties for this item.

    This version will also await any asynchronous logic that is needed to set the properties.

    Parameters

    Returns Promise<void>

  • Waits for all deserialization logic initiated thus far to finish, whether invoked by passing properties into the constructor, or by invoking assignProperties() or assignPropertiesAsync().

    Returns Promise<void>

  • See format.

    Parameters

    • format: string
    • num: number

    Returns string

  • Parameters

    Returns string

  • Parameters

    • num: number

    Returns string

  • See parse.

    Parameters

    • input: unknown

    Returns number

  • Parameters

    • format: string | string[]
    • input: unknown

    Returns number

  • Parameters

    Returns number