mirror of
https://github.com/tenrok/maska.git
synced 2026-05-24 14:04:08 +03:00
222f2df70a3bddc0045badf4a80f93e509cb0170
When a token with multiple:true does not match the next character, we need to determine if it matched any previous characters or not. If it hasn't matched any characters yet, then we skip the invalid input character and remain on the same token. If it has matched 1 or more input characters, then we advance to the next token, but stay on the same input character. The old code had several issues with this. I replaced it with a simple flag (multipleMatched) that is set to true whenever a token with multiple==true matches an input character, and can then be tested when a token with multiple==true doesn't match an input character.
Simple zero-dependency input mask for Vue 2/3 or vanilla JS.
Documentation & demo
Maska
Support ☕️
Do you like Maska? Please support me via Boosty.
Features ✨
- No dependencies and small size: ~2.5 Kb gziped
- Works with any native input
- Ability to define custom tokens
- Dynamic, reversed and eager masks
- Token modifiers, transform functions and hooks
What’s new in v2 🎉
- Fully rewritten in TypeScript
- Autobind to vue variable
- Eager and reversed masking modes
- Optonal and repeated tokens
- Simplified syntax for custom tokens
- Dynamic masks with custom function logic
- Hooks for pre/post- processing
- Ability to replace or merge custom tokens
Source of Inspiration 💡
License 📄
Description
Languages
TypeScript
91.3%
Vue
6.8%
Svelte
1.6%
JavaScript
0.2%