WebCola
Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

format

  • format(specifier: string): function
  • Returns a new format function for the given string specifier. The returned function takes a number as the only argument, and returns a string representing the formatted number.

    Uses the current default locale.

    The general form of a specifier is [​[fill]align][sign][symbol][0][width][,][.precision][type]. For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties.

    Parameters

    • specifier: string

      A Specifier string

    Returns function

      • (n: number): string
      • Parameters

        • n: number

        Returns string

formatDefaultLocale

  • Create a new locale-based object which exposes format(...) and formatPrefix(...) methods for the specified locale definition. The specified locale definition will be set as the new default locale definition.

    Parameters

    Returns FormatLocaleObject

formatLocale

  • Create a new locale-based object which exposes format(...) and formatPrefix(...) methods for the specified locale.

    Parameters

    Returns FormatLocaleObject

formatPrefix

  • formatPrefix(specifier: string, value: number): function
  • Returns a new format function for the given string specifier. The returned function takes a number as the only argument, and returns a string representing the formatted number. The returned function will convert values to the units of the appropriate SI prefix for the specified numeric reference value before formatting in fixed point notation.

    Uses the current default locale.

    The general form of a specifier is [​[fill]align][sign][symbol][0][width][,][.precision][type]. For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties.

    Parameters

    • specifier: string

      A Specifier string

    • value: number

      The reference value to determine the appropriate SI prefix.

    Returns function

      • (n: number): string
      • Parameters

        • n: number

        Returns string

formatSpecifier

  • Parses the specified specifier, returning an object with exposed fields that correspond to the format specification mini-language and a toString method that reconstructs the specifier.

    The general form of a specifier is [​[fill]align][sign][symbol][0][width][,][.precision][type]. For reference, an explanation of the segments of the specifier string, refer to the FormatSpecifier interface properties.

    Parameters

    • specifier: string

      A specifier string.

    Returns FormatSpecifier

precisionFixed

  • precisionFixed(step: number): number
  • Returns a suggested decimal precision for fixed point notation given the specified numeric step value.

    Parameters

    • step: number

      The step represents the minimum absolute difference between values that will be formatted. (This assumes that the values to be formatted are also multiples of step.)

    Returns number

precisionPrefix

  • precisionPrefix(step: number, value: number): number
  • Returns a suggested decimal precision for use with locale.formatPrefix given the specified numeric step and reference value.

    Parameters

    • step: number

      The step represents the minimum absolute difference between values that will be formatted. (This assumes that the values to be formatted are also multiples of step.)

    • value: number

      Reference value determines which SI prefix will be used.

    Returns number

precisionRound

  • precisionRound(step: number, max: number): number
  • Returns a suggested decimal precision for format types that round to significant digits given the specified numeric step and max values.

    Parameters

    • step: number

      The step represents the minimum absolute difference between values that will be formatted. (This assumes that the values to be formatted are also multiples of step.)

    • max: number

      max represents the largest absolute value that will be formatted.

    Returns number

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc