route-parser
route-parser copied to clipboard
An isomorphic, bullet-proof, ninja-ready route parsing, matching, and reversing library for Javascript in Node and the browser.
The main advantage is that the hash does not accidentally become part of a `:variable`. See the commit description for examples.
Hey, Currently when there is a slash at the end of a route, the match function returns false. For example: ```javascript routeParser('/test').match('/test/') // false ``` Is this the expected behavior?...
I'm creating a custom router similar to VueRouter. Is this module only written for nodejs?
``` const a = new RouteParser('/foo/:bar') a.reverse({bar: 'hi/test'}) // Returns "/foo/hi/test" a.reverse({bar: 'hi test'}) // Returns "/foo/hi%20test" ``` Either the first should return `"/foo/hi%2ftest"` (by calling EncodeURIComponent on each param)...
Hi, great lib btw :) I ran into following problem: ```js const RouteParser = require("route-parser") const parser = new RouteParser("/courses/:id/trainings/:idx") const route = parser.reverse({ id: "123", idx: "0" }) //...
It would be nice something like that: ```javascript var route = new Route('http://site:3000/products/:productId'); route.reverse({ productId: 123 }); ```
I am using qs to append arbitrary URL params to a route. However when I match this back, it returns the additional params I added. I would expect the below...
This lib is truly awesome! After using it for a while I came across a certain problem: Asterisks and parentheses are valid components of an URL but reserved in this...
Perhaps there's already a way to do this, but I was hoping for something along the line of "/path/to/:file(.js|.jsx)" In this one specific case, I can certainly do ":file.js(x)", but...