#

API Docs for: 3.10.3
Show: Inherited Protected Private Deprecated

# Number Class

Defined in: `number/js/number-format.js:16`
Module: datatype-number-format
Parent Module: datatype-number

Number provides a set of utility functions to operate against Number objects.

- Index
- Methods

## Item Index

### Methods

- format
- parse

## Methods

### `format`

(

- `data`
- `config`

)
HTML

Defined in `number/js/number-format.js:25`

Takes a Number and formats to string for display to user.

#### Parameters:

- `data` Number

  Number.

- `config` Object

  (Optional) Optional configuration values:

  prefix {HTML}
    String prepended before each number, like a currency designator "$"
  decimalPlaces {Number}
    Number of decimal places to round. Must be a number 0 to 20.
  decimalSeparator {HTML}
    Decimal separator
  thousandsSeparator {HTML}
    Thousands separator
  suffix {HTML}
    String appended after each number, like " items" (note the space)

#### Returns:

HTML: Formatted number for display. Note, the following values return as "": null, undefined, NaN, "".

### `parse`

(

- `data`

)
Number

Provided by the datatype-number-parse module.

Defined in `number/js/number-parse.js:12`

Converts data to type Number.

#### Parameters:

- `data` String | Number | Boolean

  Data to convert. The following values return as null: null, undefined, NaN, "".

#### Returns:

Number: A number, or null.