path-expression-matcher 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/package.json +1 -1
- package/src/Expression.js +6 -0
package/README.md
CHANGED
|
@@ -109,6 +109,19 @@ console.log(matcher.toString()); // "soap:Envelope.soap:Body.ns:UserId"
|
|
|
109
109
|
- Pattern `*::user` matches tag "user" with any namespace (wildcard namespace)
|
|
110
110
|
- Namespaces are tracked separately for counter/position (e.g., `ns1::item` and `ns2::item` have independent counters)
|
|
111
111
|
|
|
112
|
+
### Wildcard Differences
|
|
113
|
+
|
|
114
|
+
**Single wildcard (`*`)** - Matches exactly ONE level:
|
|
115
|
+
- `"*.fix1"` matches `root.fix1` (2 levels) ✅
|
|
116
|
+
- `"*.fix1"` does NOT match `root.another.fix1` (3 levels) ❌
|
|
117
|
+
- Path depth MUST equal pattern depth
|
|
118
|
+
|
|
119
|
+
**Deep wildcard (`..`)** - Matches ZERO or MORE levels:
|
|
120
|
+
- `"..fix1"` matches `root.fix1` ✅
|
|
121
|
+
- `"..fix1"` matches `root.another.fix1` ✅
|
|
122
|
+
- `"..fix1"` matches `a.b.c.d.fix1` ✅
|
|
123
|
+
- Works at any depth
|
|
124
|
+
|
|
112
125
|
### Combined Patterns
|
|
113
126
|
|
|
114
127
|
```javascript
|
package/package.json
CHANGED
package/src/Expression.js
CHANGED
|
@@ -82,6 +82,12 @@ export default class Expression {
|
|
|
82
82
|
_parseSegment(part) {
|
|
83
83
|
const segment = { type: 'tag' };
|
|
84
84
|
|
|
85
|
+
// CRITICAL: Handle wildcard FIRST (before any other parsing)
|
|
86
|
+
if (part === '*') {
|
|
87
|
+
segment.tag = '*';
|
|
88
|
+
return segment;
|
|
89
|
+
}
|
|
90
|
+
|
|
85
91
|
// NEW NAMESPACE SYNTAX (v2.0):
|
|
86
92
|
// ============================
|
|
87
93
|
// Namespace uses DOUBLE colon (::)
|