matches.js 590 B

1234567891011121314151617181920212223
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = matches;
  6. var _assertString = _interopRequireDefault(require("./util/assertString"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. function matches(str, pattern, modifiers) {
  9. (0, _assertString.default)(str);
  10. if (Object.prototype.toString.call(pattern) !== '[object RegExp]') {
  11. pattern = new RegExp(pattern, modifiers);
  12. }
  13. return pattern.test(str);
  14. }
  15. module.exports = exports.default;
  16. module.exports.default = exports.default;