index.js
function doesMatch(_ref2) {
    var matcher = _ref2.matcher;
    var err = _ref2.err;

    if (typeof matcher === 'string') {
      return err.message.indexOf(matcher) > -1;
    }
    if (matcher instanceof RegExp) {
      return matcher.test(err.message);
    }
    if (typeof matcher === 'function') {
      return matcher(err);
    }
    if (matcher.constructor === Error.constructor) {
      return err instanceof matcher;
    }
    throw new Error(UNRECOGNISED_MATCHER_ERR);
  }
function doesMatch(_ref2) {
    var matcher = _ref2.matcher;
    var err = _ref2.err;

    if (typeof matcher === 'string') {
      return err.message.indexOf(matcher) > -1;
    }
    if (matcher instanceof RegExp) {
      return matcher.test(err.message);
    }
    if (typeof matcher === 'function') {
      return matcher(err);
    }
    if (matcher.constructor === Error.constructor) {
      return err instanceof matcher;
    }
    throw new Error(UNRECOGNISED_MATCHER_ERR);
  }
Determine if the given `err` satisfies the criteria defined by `matcher`:
- if `matcher` is a String, expect the error message to contain `matcher`
- if `matcher` is a RegExp, match the error message against it
- if `matcher` is a Function, call the function with `err` and return the result
- if `matcher` is an Error, expect their constructors to be the same
@param {Object} matcher error matcher
@param {Error} err error to match against
@returns {Boolean}