page.js
page.js copied to clipboard
Separate the path matching into separate module
Obviously not a pressing issue, but a special request: to separate the matching code into a separate module.
It could make page.js more modular, perhaps easier to read/follow the code - but more importantly (and selfishly, I admit) it would make it easier for others to use that great matching capability in our own applications.
For example, there is a module called route-parser which does a similar path matching; though I personally prefer the Page/Express style. Having the latter with the former's API (ie- make a function similar to route-parser's route.match which encapsulates the Page.js functionality) would be really cool !
He uses https://www.npmjs.com/package/path-to-regexp for path matching
It seems that the best option (and the most optimized one) is lukeed/matchit.
When compared to path-to-regexp, the gain is notorious.