UNPKG

n4s

Version:

typed schema validation version of enforce

8 lines (6 loc) 244 B
import { toRegExp } from '../../utils/regex'; // Checks if string matches the given regular expression pattern export function matches(str: string, regex: RegExp | string): boolean { const r = toRegExp(regex); return !!r && r.test(str); }