@b9g/match-pattern 0.1.4 → 0.1.6

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.
Files changed (2) hide show
  1. package/README.md +11 -11
  2. package/package.json +3 -2
package/README.md CHANGED
@@ -93,20 +93,20 @@ new MatchPattern({
93
93
  })
94
94
  ```
95
95
 
96
- ## Trailing Slash Normalization
96
+ ## Trailing Slash Handling
97
97
 
98
- URLPattern has inconsistent behavior with trailing slashes that can cause unexpected matches.
99
-
100
- **Issue:** [kenchris/urlpattern-polyfill#131](https://github.com/kenchris/urlpattern-polyfill/issues/131)
101
-
102
- **Solution:** ✅ Automatic trailing slash normalization implemented
98
+ MatchPattern does not automatically normalize trailing slashes. Use explicit patterns:
103
99
 
104
100
  ```javascript
105
- const pattern = new MatchPattern('/api/posts/:id');
106
-
107
- // Both match consistently
108
- pattern.test('/api/posts/123'); // true
109
- pattern.test('/api/posts/123/'); // ✅ true (normalized)
101
+ // Exact matching
102
+ const exactPattern = new MatchPattern('/api/posts/:id');
103
+ exactPattern.test('/api/posts/123'); // true
104
+ exactPattern.test('/api/posts/123/'); // false
105
+
106
+ // Optional trailing slash
107
+ const flexiblePattern = new MatchPattern('/api/posts/:id{/}?');
108
+ flexiblePattern.test('/api/posts/123'); // ✅ true
109
+ flexiblePattern.test('/api/posts/123/'); // ✅ true
110
110
  ```
111
111
 
112
112
  ## Known Limitations
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@b9g/match-pattern",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "devDependencies": {
5
- "@b9g/libuild": "^0.1.10"
5
+ "@b9g/libuild": "^0.1.11",
6
+ "bun-types": "latest"
6
7
  },
7
8
  "peerDependencies": {
8
9
  "urlpattern-polyfill": "^10.0.0"