1.0.13 • Published 2 years ago
simple-mask v1.0.13
Simple mask
This package used to mask input by string pattern
Installation
npm install simple-mask --save
Usage
import { mask } from 'simple-mask';
mask(input, {
mask: '+7 *** *** ** **',
replace: /\D/g,
});
Usage from CDN
<script src="https://cdn.jsdelivr.net/npm/simple-mask@latest/index.min.js"></script>
SimpleMask.mask(input, {
mask: '+7 *** *** ** **',
replace: /\D/g,
});
Options
mask
: string
The masking pattern to be applied to the <input>
.
maskSymbol
: string
Symbol used in mask pattern which will replaced on input
Default:
'*'
replace
: string | RegExp
Symbols to replace
replacement
: string
Symbols which will insert instead
Default:
''