Matcher wrapMatcher(x)

Takes an argument and returns an equivalent Matcher.

If the argument is already a matcher this does nothing, else if the argument is a function, it generates a predicate function matcher, else it generates an equals matcher.

Source

Matcher wrapMatcher(x) {
  if (x is Matcher) {
    return x;
  } else if (x is _Predicate) {
    return predicate(x);
  } else {
    return equals(x);
  }
}