visionmedia / page.js

Micro client-side router inspired by the Express router
http://visionmedia.github.com/page.js
7.67k stars 687 forks source link

Separate the path matching into separate module #482

Open drschwabe opened 6 years ago

drschwabe commented 6 years ago

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 !

Subterrane commented 6 years ago

He uses https://www.npmjs.com/package/path-to-regexp for path matching

paulocoghi commented 6 years ago

It seems that the best option (and the most optimized one) is lukeed/matchit.

When compared to path-to-regexp, the gain is notorious.