Add multi-pattern support. #38
Looks awesome on first review. Much appreciated! |
Cool, no problem. BTW, we have a few more bug fixes and enhancements underway. So if you'd prefer to wait a few more days (mid next week?) to merge/release that's fine with us! |
@jaridmargolin This is good to go! Thanks. |
Really solid work. |
1 check passed
Will bump the version so this is accessible via various package mangers. |
@mickeyreiss nice work. |
@jaridmargolin Can you @reply me when release is complete, so I can move our internal stuff off of our fork@master, onto your new version. |
@mickeyreiss - v0.1.1 has been released. |
@mickeyreiss - I have actually reverted some of the work you completed. Specifically the last PR titled, "Fix trailing format char bugs for persistent false." Reasoning: Thanks. |
Hi there!
We wanted to use this library to add validations on a credit card form. In our case, the desired behavior was to change the formatting patterns based on the credit card type and whether or not the user enters an expiration date starting with a 0, 1, or other number.
In order to accomplish this, we augmented
formatter.js
to accept a set of patterns, in addition to the single pattern it previously accepted. Basically, you provide a set of regex patterns and corresponding format patterns. The library then dynamically applies a pattern based on the input element's value each time it changes.These changes are fully backwards compatible with one exception.
myFormatter.opts.pattern
is no longer accessible as the pattern now is saved as apatternMatcher
, rather than a pattern string.The changes to README and tests should give you a more precise outline of the new behavior.
Cheers!
Mickey