Installation
Quick Take
API — remSep()
The main function remSep() is imported like this:
It’s a function which takes three input arguments:
| Input argument | Type | Obligatory | Description |
|---|---|---|---|
strType: String Obligatory: yes | |||
str | String | yes | Input to work upon. |
optsType: Plain object Obligatory: no | |||
opts | Plain object | no | Optional Options Object. |
None of the input arguments will be mutated by this program, we have unit tests to prove that.
The Optional Options Object has the following shape:
| Key | Type | Default | Description |
|---|---|---|---|
removeThousandSeparatorsFromNumbersType: Boolean Default: true | |||
removeThousandSeparatorsFromNumbers | Boolean | true | Should remove thousand separators? 1,000,000 → 1000000? Or Swiss-style, 1'000'000 → 1000000? Or Russian-style, 1 000 000 → 1000000? |
padSingleDecimalPlaceNumbersType: Boolean Default: true | |||
padSingleDecimalPlaceNumbers | Boolean | true | Should we pad one decimal place numbers with zero? 100.2 → 100.20? |
forceUKStyleType: Boolean Default: false | |||
forceUKStyle | Boolean | false | Should we convert the decimal separator commas into dots? 1,5 → 1.5? |
Here are all defaults in one place for copying:
The function will return a string, the input with thousand separators removed.
API — defaults
You can import defaults:
It's a plain object:
The main function calculates the options to be used by merging the options you passed with these defaults.
API — version
You can import version: