Skip to content

v4.0.0

Compare
Choose a tag to compare
@sindresorhus sindresorhus released this 28 Feb 10:59
· 5 commits to main since this release

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 return true. Now it will always return false.
  • 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 with matcher.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.

v3.0.0...v4.0.0