code: function getRegex(regex, flags) {
    var result = typeOf(regex) === 'String'
      ? new RegExp(regex, flags || '')
      : regex
  
    if (typeOf(result) !== 'RegExp') {
      throw new Error(
        NAME + ': option "regex" must be a string or a RegExp object')
    }
  
    return result
  }
docs: Transform regex into a RegExp if it isn't one already.
  
  @param {any} regex
  @param {string} flags
  @returns {RegExp}