next()

in packages/path/src/matcher.ts [46:75]


  next(node: Node, pos: number) {
    //  const isOverToken = pos > this.path.length
    if (node.after) {
      // if (isOverToken) {
      //   return false
      // }
      return this.matchNode(node.after, pos)
    }

    if (isWildcardOperator(node) && !node.filter) {
      if (this.excluding) {
        return false
      } else {
        if (pos === 0 || node.optional) return true
        return !!this.take(pos)
      }
    }

    const isLastToken = pos === this.path.length - 1
    if (isLastToken) {
      return !!this.take(pos)
    } else {
      const wildcard = this.wildcards.pop()
      if (wildcard && wildcard.after) {
        return this.next(wildcard, pos)
      }
    }

    return false
  }