While using the plugin I noticed that when I have a pattern that has suffix chars and no pattern after them the library throws an error:
TypeError: Cannot read property 'index' of undefined
at Object.pattern.parse (/Users/.../Desktop/.../formatter.js/src/pattern.js:61:29)
For example I might have a pattern for a a VAT number that looks like this:
CHE-.. _ MWST
where the underscores are digits, so the pattern using formatter.js would be:
'pattern': 'CHE-{{999}}.{{999}}.{{999}} MWST'
which would throw an error when I open the page in a browser: 'Cannot read property 'index' of undefined' in line 61 of the formatter.js/src/pattern.js file. The only way this works is if I added a pattern after the ' MWST' suffix chars. Something like this: CHE-{{999}}.{{999}}.{{999}} MWST{{*}}
but I don't want to do that because it will add an extra character to the end of the input (at the very least a space character) and then the input would not pass validation. I added a test so you can see a similar case fail and then I applied a fix.
Thank you for your time and for this awesome library :)
While using the plugin I noticed that when I have a pattern that has suffix chars and no pattern after them the library throws an error:
TypeError: Cannot read property 'index' of undefined at Object.pattern.parse (/Users/.../Desktop/.../formatter.js/src/pattern.js:61:29)
For example I might have a pattern for a a VAT number that looks like this: CHE- . . _ MWST
where the underscores are digits, so the pattern using formatter.js would be:
'pattern': 'CHE-{{999}}.{{999}}.{{999}} MWST'
which would throw an error when I open the page in a browser: 'Cannot read property 'index' of undefined' in line 61 of the formatter.js/src/pattern.js file. The only way this works is if I added a pattern after the ' MWST' suffix chars. Something like this: CHE-{{999}}.{{999}}.{{999}} MWST{{*}}
but I don't want to do that because it will add an extra character to the end of the input (at the very least a space character) and then the input would not pass validation. I added a test so you can see a similar case fail and then I applied a fix.
Thank you for your time and for this awesome library :)