1.0.0 • Published 5 years ago
dynamic-input-mask v1.0.0
Dynamic Input JS
Developed for education and as a lightweight alternative to input masking libraries. Instead of building all of the masking functions this takes the approach of a utility/factory class. You can pass a broken RegExp to the constructed input array, and it will apply the necesary listeners to make the mask function.
Examples
const inputs = input(document.getElementById('weee'));
inputs.mask(
[/[0-3]/, /\d/, /\d/, /\d/, /\-/, /[0-1]/, /\d/, /\-/, /[0-3]/, /\d/],
['', '', '', '', '-', '', '', '-', '', '']
);
1.0.0
5 years ago