Releases: sindresorhus/matcher
Releases · sindresorhus/matcher
v5.0.0
Breaking
- Require Node.js 12.20 7aac07d
- This package is now pure ESM. Please read this.
- Changed from a default export to named exports.
Improvements
- Add
allPatterns
option (#26) c96447a - Make negated pattern position-insensitive (#30) 43d778c
v4.0.0
Breaking
- When passing an empty array of rules to
matcher()
, it would return the entire array of inputs with no filtering. Now it will return an empty array. - When passing an empty array of rules to
matcher.isMatch()
, it would always returntrue
. Now it will always returnfalse
. - In certain cases it was possible to pass unsupported variable types to the functions and still receive a normal return value. This is no longer possible because of explicit type checks. This would have been very buggy to use, and should not have been used in production, but it is still a breaking change.
Improvements
matcher()
now also supports passing a string instead of an array of strings. This simplifies the code base and makes the interface consistent withmatcher.isMatch()
.- Both functions now fully support passing
undefined
variables to them. This was mostly supported before, but had several edge cases where it would crash the process. It was possible to ship code that seemed to work, but would crash under certain conditions.
Fixes
- When passing unsupported variable types in the arrays of either function, they will now throw a proper
TypeError
with an explanation instead of crashing in all sorts of interesting ways.