one-separator-decimal-mask

0.0.6 • Public • Published

one-separator-decimal-mask

travis-ci.org

NPM

  • Converts input value to a string with separator decimal passed as paramater, locale is irrelevant. Using one-separator-decimal.

Install

npm install one-separator-decimal-mask

Usage

    import mask from 'one-separator-decimal-mask'
 
    ...
 
    /**
    * @license MIT License
    * @param {String} input 
    * @param {String} [separator='.'] The separator is optional, default value is a dot.
    *
    */
    let result = mask('10,,')
    //result = "10"

Validations

NaN

√ should return "" when the value is `test`

Integer number input values

√ should return "10" when the value is `10`

Floating number input values

√ should return "10.0" when the value is `10,0`
√ should return "10.0" when the value is `10.0`
√ should return "10.60" when the value is `10.60`
√ should return "10.601" when the value is `10.601`

Last index is not a number

√ should return "10." when the value is `10,`
√ should return "10." when the value is `10.`
√ should return "10." when the value is `10,,`
√ should return "10." when the value is `10..`
√ should return "1000." when the value is `10,00,`
√ should return "1000." when the value is `10.00.00`

Second dot or comma

√ should return "1000.01" when the value is `10,00,01`
√ should return "1000.01" when the value is `10.00.01`

License

MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i one-separator-decimal-mask

Weekly Downloads

3

Version

0.0.6

License

MIT

Unpacked Size

10.9 kB

Total Files

8

Last publish

Collaborators

  • tiago-marques