0.0.6 • Published 7 years ago

one-separator-decimal-mask v0.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago