regexparam icon indicating copy to clipboard operation
regexparam copied to clipboard

A tiny (394B) utility that converts route patterns into RegExp. Limited alternative to `path-to-regexp` 🙇‍♂️

Results 7 regexparam issues
Sort by recently updated
recently updated
newest added

@lukeed, thank you for creating `regexparam` (and `polka`). It was a joy to build on your lean-and-mean route matching utility for `u8-mqtt`. Cheers, -Shane

Hi! I noticed that you were golfing. I couldn't resist. 🏌️ This reduces minified, compressed bytes from 249 to 234.

What's the recommended way to handle path parameters that may contain slashes? For example, we have a `/docs/` path in our app that contains nested paths or arbitrary length. For...

Please see https://github.com/lukeed/trouter/issues/25 The issue stems from `\/?` being matched at the end of all patterns in regexparam: https://github.com/aral/regexparam/blob/master/src/index.js#L28

Without implementation signature we get an error when passing `string | RegExp` to the `parse` function: ```ts declare const route: string | RegExp; parse(route); /* No overload matches this call....

With `RouteParams` the inferred types seem to parse the route incorrectly. Expected: ```ts { routeId: string; slugStr?: string | undefined; subPage?: string | undefined; } ``` Actual: ```ts { "routeId/slugStr"?:...

Fixed a problem that RouteParams type was not correctly inferred in cases where an extension was given, such as `/foo/:bar.mp4`. Also, fixed the problem that `:action` part was mis-detected when...