code: function pathToRegexp(val, keys, options) {
    return new RegExp(toRegexpSource(val, keys, options), flags(options));
  }
docs: based on https://github.com/pillarjs/path-to-regexp/ with modifications
   
  Normalize the given path string, returning a regular expression.
  
  An empty array can be passed in for the keys, which will hold the
  placeholder key descriptions. For example, using `/user/:id`, `keys` will
  contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  
  @param  {(string|RegExp|Array)} path
  @param  {Array=}                keys
  @param  {Object=}               options
  @return {!RegExp}