matches.js 283 B

12345678910
  1. import assertString from './util/assertString';
  2. export default function matches(str, pattern, modifiers) {
  3. assertString(str);
  4. if (Object.prototype.toString.call(pattern) !== '[object RegExp]') {
  5. pattern = new RegExp(pattern, modifiers);
  6. }
  7. return !!str.match(pattern);
  8. }