unjs / rou3

🌳 Lightweight and fast rou(ter) for JavaScript
MIT License
442 stars 16 forks source link

fix(matchAll): sort routes with same type #45

Closed pi0 closed 1 year ago

pi0 commented 1 year ago

resolves #44

The return value of matchAll normally should return from less specific to most specific matches (wildcard > params > static). However when checking same kind of rules, like between wildcards, we was not sorting them. Comparing by length as simplest possible workaround we might improve it later if there was more edge cases when comparing same type.