code: function regexpPattern(pattern) {
    if (!pattern) {
      return pattern;
    }
    // A very simplified glob transform which allows passing legible strings like
    // "myPath/*.js" instead of a harder to read RegExp like /\/myPath\/.*\.js/.
    if (typeof pattern === 'string') {
      pattern = pattern.replace(/\./g, '\\.').replace(/\*/g, '.*');
      if (pattern[0] !== '/') {
        pattern = '/' + pattern;
      }
      return new RegExp(pattern);
    }
    if (typeof pattern.test === 'function') {
      return pattern;
    }
    throw new Error(
      'flow-remove-types: includes and excludes must be RegExp or path strings. Got: ' + pattern
    );
  }
docs: Given a null | string | RegExp | any, returns null | Regexp or throws a more helpful error.