4.1.2 • Published 5 years ago

number-format-x v4.1.2

Weekly downloads
61
License
MIT
Repository
github
Last release
5 years ago

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.

ParamTypeDefaultDescription
valuenumberThe numerical value to be formatted.
digitsnumber2The number of digits to appear after the decimal point; this may be a value between 0 and 20, inclusive.
sectionLengthnumber3Length of integer part sections.
sectionDelimiterstring","Integer part section delimiter.
decimalDelimiterstring"."Decimal delimiter.

Example

import numberFormat from 'number-format-x';

numberFormat(12345678.9, 3); // "12,345,678.900"
numberFormat(12345678.9, null, null, '.', ','); // "12.345.678,90"
numberFormat(123456.789, 4, 4, ' ', ':'); // "12 3456:7890"
numberFormat(12345678.9, 0, null, '-'); // "12-345-679"
4.1.2

5 years ago

4.1.1

5 years ago

4.1.0

5 years ago

4.0.10

5 years ago

4.0.9

5 years ago

4.0.8

5 years ago

4.0.7

5 years ago

4.0.6

5 years ago

4.0.5

5 years ago

4.0.4

5 years ago

4.0.3

5 years ago

4.0.2

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.0.0

7 years ago

2.1.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago