number-format-x
Format a number.
module.exports(value, [digits], [sectionLength], [sectionDelimiter], [decimalDelimiter])
⇒ string
⏏
Format a given number using fixed-point notation, with user specified digit
counts and seperators. null
or 'undefined' can be used for optional
arguments to denote that the default value is to be used.
Kind: Exported function
Returns: string
- The numerical value with the choosen formatting.
Param | Type | Default | Description |
---|---|---|---|
value | number |
The numerical value to be formatted. | |
[digits] | number |
2 |
The number of digits to appear after the decimal point; this may be a value between 0 and 20, inclusive. |
[sectionLength] | number |
3 |
Length of integer part sections. |
[sectionDelimiter] | string |
"," |
Integer part section delimiter. |
[decimalDelimiter] | string |
"." |
Decimal delimiter. |
Example
; ; // "12,345,678.900"; // "12.345.678,90"; // "12 3456:7890"; // "12-345-679"