API Docs for:
Show:

Formatter.number Class

Defined in: ../lib/pat.js:951
Module: pat

Number formatter.

Item Index

Methods

Methods

toDecimal

(
  • arg
  • [options]
)
String static

Defined in ../lib/pat.js:1014

Returns a string representing the given number in decimal form.

Parameters:

  • arg Any

    Number compatible value to be formatted

  • [options] Object optional

    Formatting options. Default values:

    {
        precision: undefined,   // Number of significant fractional digits. Data
                                // type limited for falsy values other than 0.
        considerZeroSign: false // Whether to return a sign for negative zero or not
    }
    

Returns:

String:

toHexExp

(
  • arg
)
String static

Defined in ../lib/pat.js:957

Parameters:

  • arg Any

    Number compatibel argument

Returns:

String: Hex exponential form of the given string

toScientific

(
  • arg
  • [options]
)
String static

Defined in ../lib/pat.js:1084

Returns a string representing the given number in scientific notation.

Parameters:

  • arg Any

    Number compatible value to be formatted

  • [options] Object optional

    Formatting options. Default values:

    {
        precision: undefined,   // Mantissa precision. Data type limited for falsy
                                // values other than 0.
        expMinWidth: 1,         // Min width of the exponent (excl. 'e' and sign).
        upperCase: false,       // Whether to use 'e' or 'E' for the exponent.
        considerZeroSign: false // Whether to return a sign for negative zero or not
    }
    

Returns:

String: