You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var toPathRegexp =pathToRegexp.compile('/user/:id(\\d+)')
180
+
181
+
toPathRegexp({ id:123 }) //=> "/user/123"
182
+
toPathRegexp({ id:'123' }) //=> "/user/123"
183
+
toPathRegexp({ id:'abc' }) //=> throws TypeError
174
184
```
175
185
176
186
**Note:** The generated function will throw on any invalid input. It will execute all necessary checks to ensure the generated path is valid. This method only works with strings.
0 commit comments