reMask

A multi-mask lib

Install

yarn add vanilla-masker remask

Usage

import { mask } from 'remask'

const value = 'ABC1C83'
const pattern = 'AAA - 9S99'

mask(value, pattern)
// ABC - 1C83

Pattern can be a pattern array, so remask choose one pattern based on pattern/value length match

const patterns = ['999.999.999-99', '99.999.999/9999-99']

mask('12345678901', patterns) // gets firts pattern (999.999.999-99)
// 123.456.789-01

mask('12345678000106', patterns) // gets second pattern (99.999.999/9999-99)
// 12.345.678/0001-06

License

MIT © Bruno Bertolini

Remask

A multi-mask lib

Remask Info

⭐ Stars91
🔗 Homepagecodesandbox.io
🔗 Source Codegithub.com
🕒 Last Update10 months ago
🕒 Created4 years ago
🐞 Open Issues15
➗ Star-Issue Ratio6
😎 Authorbrunobertolini