kitbagjs / router

A type safe router for vuejs
MIT License
133 stars 1 forks source link

Route matching updates #145

Closed stackoverfloweth closed 2 months ago

stackoverfloweth commented 2 months ago

while documenting route matching I discovered a bug with query regex matching when the value is static

const route = {
  ...
  query: 'foo=bar'
}

the regex was not asserting end of the value as either & or $ (ampersand or end of input). This meant the following would be considered a match

Also while documenting route scoring I thought it was strange that we rank routes higher for having provided query params that are optional but not doing the same for path params. This means

const route = {
  ...
  path: /:?optionalA/:?optionalB/:?optionalC
  query: 'foo=:?optionalFoo'
}

would choose

over

even though the ladder fulfills 3 optional params and the former only 1

both are fixed by this PR

netlify[bot] commented 2 months ago

Deploy Preview for kitbag-router ready!

Name Link
Latest commit 040d06e4874ebf68159b792ea6f1c89147a7c3a5
Latest deploy log https://app.netlify.com/sites/kitbag-router/deploys/662e545b96237500083ee081
Deploy Preview https://deploy-preview-145--kitbag-router.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.