format
String
format
(
data
,
config
)
Takes a Number and formats to string for display to user.
- Parameters:
-
data <Number>
Number. -
config <Object} (Optional) Optional configuration values:
- prefix {String}
- 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 {String}
- Decimal separator
- thousandsSeparator {String}
- Thousands separator
- suffix {String>
- String appended after each number, like " items" (note the space)
- Returns:
String
- Formatted number for display. Note, the following values return as "": null, undefined, NaN, "".
parse
Number
parse
(
data
)
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.