Skip to content

Commit

Permalink
fix(path): fix range all match is not expect (#3067)
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang authored Apr 24, 2022
1 parent 34e9420 commit 04e753f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/path/src/__tests__/match.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,12 @@ test('group match with destructor', () => {
).toEqual(true)
})

test('all range match', () => {
expect(
Path.parse('array.*[:].*[:].*[:].bb').match('array.0.0.0.aa')
).toBeFalsy()
})

match({
'*': [[], ['aa'], ['aa', 'bb', 'cc'], ['aa', 'dd', 'gg']],
'*.a.b': [
Expand Down
3 changes: 2 additions & 1 deletion packages/path/src/matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ export class Matcher {
if (node.end) {
return current <= Number(node.end.value)
} else {
return true
this.wildcards = this.stack.slice() as WildcardOperatorNode[]
return this.next(node, pos)
}
}
}
Expand Down

0 comments on commit 04e753f

Please sign in to comment.