2.1.0 • Published 6 years ago

mask-js v2.1.0

Weekly downloads
214
License
MIT
Repository
github
Last release
6 years ago

mask-js build status Code Coverage License NPM version

mask-js

A library that exposes functions to masks strings. To use it, it's pretty simple. First, you need to install it:

npm i mask-js

Then, you can import its functions and use at will:

import {maskJs, maskCurrency} from 'mask-js';

console.log(maskJs('(99) 99', '0123456') === '(01) 23'); // true
console.log(maskCurrency('12345') === 123.45); // true

The library also supports optional digits. For example:

import maskJs from 'mask-js';

console.log(maskJs('(99) 9999?9', '0123456') === '(01) 23456'); // true
console.log(maskJs('(99) 999-9?9', '012345') === '(01) 234-5'); // true
console.log(maskJs('(99) 99?9-9?9', '012345') === '(01) 23-45'); // true
console.log(maskJs('(99) 9999?9-9999', '0123456789') === '(01) 2345-6789'); // true
console.log(maskJs('(99) 9999?9-9999', '01234567890') === '(01) 23456-7890'); // true

License

This project is licensed under the MIT license. See the LICENSE file for more info.

2.1.0

6 years ago

2.0.0

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.6

6 years ago