Skip to content

route-pattern v0.7.0

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 01 Sep 16:52
  • Add support for nested optionals in route patterns
// Now you can do stuff like
let pattern = new RoutePattern('api(/v:major(.:minor))')
pattern.match('https://remix.run/api') // { params: {} }
pattern.match('https://remix.run/api/v1') // { params: { major: '1' } }
pattern.match('https://remix.run/api/v1.2') // { params: { major: '1', minor : '2' } }
  • Make pattern.match().params type-safe
  • Export top-level Params<pattern> helper for extracting params from a pattern
  • Tighten up some types in href(). Now you get variants for
    • all the different values of an enum
    • unnamed wildcards
  • Fix bug when using unnamed wildcards in href()