@mockmaster/core 1.0.3 → 1.0.4

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 +28 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -75,6 +75,34 @@ Creates a mock object with path, method, and response.
75
75
 
76
76
  Finds the first mock matching the given path and method.
77
77
 
78
+ ### `extractParams(pattern: string, path: string): Record<string, string> | null`
79
+
80
+ Extracts parameter values from a path.
81
+
82
+ ```typescript
83
+ import { extractParams } from '@mockmaster/core'
84
+
85
+ const params = extractParams('/users/:id', '/users/123')
86
+ // { id: '123' }
87
+
88
+ const params2 = extractParams('/users/:userId/posts/:postId', '/users/1/posts/42')
89
+ // { userId: '1', postId: '42' }
90
+ ```
91
+
92
+ ### `createMatcher(patterns: string[]): (path: string) => boolean`
93
+
94
+ Creates a matcher function from multiple patterns.
95
+
96
+ ```typescript
97
+ import { createMatcher } from '@mockmaster/core'
98
+
99
+ const matcher = createMatcher(['/api/*', '/users/:id'])
100
+
101
+ matcher('/api/users') // true
102
+ matcher('/users/123') // true
103
+ matcher('/posts/456') // false
104
+ ```
105
+
78
106
  ## Links
79
107
 
80
108
  - [Main Documentation](https://github.com/PxPerfectMike/MockMaster)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mockmaster/core",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Core mocking engine for mock-master",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",