src/State.js
function matches(paths) {
    const params = {}
    const nonRestStatePaths = state.paths.filter(p => p[p.length - 1] !== '*')

    /* This state has more paths than the passed paths, it cannot be a match */
    if (nonRestStatePaths.length > paths.length) return false

    /* Checks if the paths match one by one */
    for (let i = 0; i < paths.length; i++) {
      const path = paths[i]
      const thatPath = state.paths[i]

      /* This state has less paths than the passed paths, it cannot be a match */
      if (!thatPath) return false

      const isRest = thatPath[thatPath.length - 1] === '*'
      if (isRest) {
        const name = paramName(thatPath)
        params[name] = paths.slice(i).join('/')
        return params
      }

      const isDynamic = thatPath[0] === ':'
      if (isDynamic) {
        const name = paramName(thatPath)
        params[name] = path
      }
      else if (thatPath != path) return false
    }

    return params
  }
function matches(paths) {
    const params = {}
    const nonRestStatePaths = state.paths.filter(p => p[p.length - 1] !== '*')

    /* This state has more paths than the passed paths, it cannot be a match */
    if (nonRestStatePaths.length > paths.length) return false

    /* Checks if the paths match one by one */
    for (let i = 0; i < paths.length; i++) {
      const path = paths[i]
      const thatPath = state.paths[i]

      /* This state has less paths than the passed paths, it cannot be a match */
      if (!thatPath) return false

      const isRest = thatPath[thatPath.length - 1] === '*'
      if (isRest) {
        const name = paramName(thatPath)
        params[name] = paths.slice(i).join('/')
        return params
      }

      const isDynamic = thatPath[0] === ':'
      if (isDynamic) {
        const name = paramName(thatPath)
        params[name] = path
      }
      else if (thatPath != path) return false
    }

    return params
  }
/*
Returns whether this state matches the passed path Array.
In case of a match, the actual param values are returned.