lib/to-regex.js
function regexpToRegexp(regex, keys, options) {
  if (!Array.isArray(keys)) return regex.source;

  let groups = regex.source.match(/\((?!\?)/g);
  if (!groups) return regex.source;

  let i = 0;
  let group = () => ({
    name: i++,
    prefix: null,
    delimiter: null,
    optional: false,
    repeat: false,
    partial: false,
    pattern: null
  });

  groups.forEach(() => keys.push(group()));
  return regex.source;
}
function regexpToRegexp(regex, keys, options) {
  if (!Array.isArray(keys)) return regex.source;

  let groups = regex.source.match(/\((?!\?)/g);
  if (!groups) return regex.source;

  let i = 0;
  let group = () => ({
    name: i++,
    prefix: null,
    delimiter: null,
    optional: false,
    repeat: false,
    partial: false,
    pattern: null
  });

  groups.forEach(() => keys.push(group()));
  return regex.source;
}
function regexpToRegexp ( regex , keys , options ) { if ( ! Array . isArray ( keys ) ) return regex . source ; let groups = regex . source . match ( / \((?!\?) / g ) ; if ( ! groups ) return regex . source ; let i = 0 ; let group = ( ) => ( { name : i ++ , prefix : null , delimiter : null , optional : false , repeat : false , partial : false , pattern : null } ) ; groups . forEach ( ( ) => keys . push ( group ( ) ) ) ; return regex . source ; }
Create keys from match groups in the given regex
@param  {!RegExp} path
@param  {Array=}  keys
@return {!RegExp}
Create keys from match groups in the given regex