summaryrefslogtreecommitdiff
path: root/src/node_modules/validator/es/lib/matches.js
blob: 7840b1c4a37fd3ee5845a1d8e387856c01fa693c (plain)
1
2
3
4
5
6
7
8
9
10
import assertString from './util/assertString';
export default function matches(str, pattern, modifiers) {
  assertString(str);

  if (Object.prototype.toString.call(pattern) !== '[object RegExp]') {
    pattern = new RegExp(pattern, modifiers);
  }

  return pattern.test(str);
}