Variable FormatConst

Format: {
    lineSeparator: string;
    debug(object, settings?) => string;
    debugAny<T_1>(output, object) => Output<T_1>;
    debugChar<T_4>(output, character) => Output<T_4>;
    debugNumber<T_3>(output, value) => Output<T_3>;
    debugString<T_5>(output, string) => Output<T_5>;
    decimal(value, precision?) => string;
    display(object, settings?) => string;
    displayAny<T>(output, object) => Output<T>;
    displayNumber<T_2>(output, value) => Output<T_2>;
    duration(millis, separator?) => string;
    prefix(value, precision?) => string;
}

utility functions for formatting values.

Type declaration

  • Readonly lineSeparator: string

    The operating system specific string used to separate lines of text.

  • debug:function
    • Returns the developer-readable [[Debug]] string for the given object, output using the given settings. Delegates to [[Debug.debug]], if object implements Debug; returns a JavaScript string literal, if object is a string, and returns a JavaScript number literal, if object is a number; otherwise returns the result of Object.toString.

      Parameters

      Returns string

  • debugAny:function
    • Writes the code points of the developer-readable [[Debug]] string for the given object to output. Assumes output is a Unicode Output writer with sufficient capacity. Delegates to [[Debug.debug]], if object implements Debug; writes a JavaScript string literal, if object is a string, and writes a JavaScript number literal, if object is a number; otherwise writes the result of Object.toString.

      Type Parameters

      • T_1

      Parameters

      • output: Output<T_1>
      • object: unknown

      Returns Output<T_1>

      the continuation of the output.

      Throws

      [[OutputException]] if the output exits the cont state before the full debug string has been written.

  • debugChar:function
    • Writes the code points of the JavaScript character literal for the given character to output.

      Type Parameters

      • T_4

      Parameters

      • output: Output<T_4>
      • character: number

      Returns Output<T_4>

      the continuation of the output.

  • debugNumber:function
    • Writes the code points of the JavaScript numeric literal for the given value to output.

      Type Parameters

      • T_3

      Parameters

      • output: Output<T_3>
      • value: number

      Returns Output<T_3>

      the continuation of the output.

  • debugString:function
    • Writes the code points of the JavaScript string literal for the given string to output.

      Type Parameters

      • T_5

      Parameters

      • output: Output<T_5>
      • string: string

      Returns Output<T_5>

      the continuation of the output.

  • decimal:function
    • Parameters

      • value: number
      • Optional precision: number

      Returns string

  • display:function
    • Returns the human-readable [[Display]] string for the given object, output using the given settings. Delegates to [[Display.display]], if object implements Display; otherwise returns the result of Object.toString.

      Parameters

      Returns string

  • displayAny:function
    • Writes the code points of the human-readable [[Display]] string for the given object to output. Assumes output is a Unicode Output writer with sufficient capacity. Delegates to [[Display.display]], if object implements Display; otherwise writes the result of Object.toString.

      Type Parameters

      • T

      Parameters

      • output: Output<T>
      • object: unknown

      Returns Output<T>

      the continuation of the output.

      Throws

      [[OutputException]] if the output exits the cont state before the full display string has been written.

  • displayNumber:function
    • Writes the code points of the numeric string for the given value to output.

      Type Parameters

      • T_2

      Parameters

      • output: Output<T_2>
      • value: number

      Returns Output<T_2>

      the continuation of the output.

  • duration:function
    • Returns a string representation of the duration represented by the given number of milliseconds.

      Parameters

      • millis: number
      • Optional separator: string

      Returns string

  • prefix:function
    • Returns a string representation of value scaled by its SI magnitude, keeping at most precision digits past the decimal place, appended with the appropriate SI prefix.

      Parameters

      • value: number
      • Optional precision: number

      Returns string

Generated using TypeDoc