firstopinion/formatter.js — pull request #38 by braintreeps (2014-03-15 00:23:26+00:00)
Title: Add multi-pattern support.

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 a `patternMatcher`, rather than a pattern string.

The changes to README and tests should give you a more precise outline of the new behavior.

Cheers!
Mickey