1.0.0 • Published 8 years ago
expect-match v1.0.0
expect-match
A throwing variant of str.match.
If the string matches the pattern, it acts just like the regular .match.
Otherwise it turns this:
const [, a] = 'foo'.match(/^(\d+)$/);
// TypeError: Cannot read property 'Symbol(Symbol.iterator)' of "foo".matchInto this:
const expectMatch = require('expect-match');
const [, b] = expectMatch('foo', /^(\d+)$/);
// TypeError: String did not match patternFor convenience it also exposes an error code (ENOMATCH).
1.0.0
8 years ago