Support for multiple patterns
You can now provide up to 5 patterns to .with()
, and the code branch will be chosen if your input matches one of these patterns.
Example:
match<Country>('France')
.exhaustive()
// if it matches one of these patterns
.with('France', 'Germany', 'Spain', () => 'Europe')
.with('USA', () => 'America')
.run();
match<Country>('France')
.exhaustive()
.with('Germany', 'Spain', () => 'Europe')
.with('USA', () => 'America')
// doesn't compile! 'France' is missing
.run();