- [#114] fix handling of array like query params
- [#110]
routr
uses nativeURLSearchParams
instead ofquery-string
to parse query strings. As a consequence, parsing?foo
will result in{ foo: '' }
as specified in the WHATWG spec instead of{ foo: null }
asquery-string
would do. Also,URLSearchParams
is not available in older browsers (noticeably IE11). If you need to support them, you can either add aURLSearchParams
polyfill or injectquery-string
when instantiatingroutr
:
router = new Routr(routes, {
queryLib: require('query-string'),
});
- [#113] Updated
path-to-regexp
to its latest version
- [#37] Enhance makePath for routes with path array
- [#36] Bug fix: Add support for question marks in hash fragments
- [#35] Fix decodeURIComponent of undefined bug
- [#33]
getRoute
will nowdecodeURIComponent
route values, you might need to removedecodeURIComponent
from your route actions if you were supporting extended characters manually in your routes.
- [#29]
navigate
is no longer used as part ofrouter.getRoute
options - [#29]
route.navigate
has been removed from the matched route object
- [#30] Route definitions should now be defined as an array of route objects rather than a map of routes. The old method of defining routes with a map is still supported, but ordering can not be guaranteed (as per the JavaScript engine's implementation).
- [#31] Added support for parsing and constructing urls with query strings.
Matched route objects now contain a
query
property containing the map of query parameters.router.makePath
now accepts a thirdquery
parameter which is a map of query parameters to add to the resulting URL string. e.g.router.makePath('home', {}, { foo: 'bar' });
will result in/?foo=bar
. Query strings are generated using thequery-string
npm module, but can be customized by adding theoptions.queryLib
to theRouter
constructor. The replacement should have aparse
andstringify
method similar toquery-string
. An example replacement would beqs
. - [#32] Allow routes to match multiple HTTP methods by using an array
for the
route.method
attribute. By default, routes with an undefinedmethod
will match ANY method.
- [#27] Support for array paths with parameter name collision
- Replace
reverand
withpath-to-regexp
for creation of paths
- [#22] Make route methods case-insensitive
- Renamed "path" field to "url" in the return object of getRoute()
- Update devDependencies and Readme
- Freeze route objects in non-production environments
- Allow matching paths containing query strings
- Updated dependencies
- [#2] Introduction of
navigate
property under route
First version.