universal-router
Advanced tools
Changelog
[5.0.0] - 2017-10-30
null
(BREAKING CHANGE #140)Migration from v4 to v5:
resolveRoute
option for custom route handling logic then you need
to return undefined
instead of null
in cases when a route should not matchnull
are working as you expect,
child routes are no longer executed in this caseChangelog
[4.3.0] - 2017-10-22
Changelog
[4.2.0] - 2017-09-20
const routes = [
{ path: '/posts', ... }, // matches both "/posts" and "/posts/"
{ path: '/posts/', ... }, // matches only "/posts/"
]
const router = new UniversalRouter({
name: 'page',
path: ['/one', '/two', /RegExp/], // only first path is used for url generation
})
const url = generateUrls(router)
url('page') // => /one
Changelog
[4.1.0] - 2017-09-20
Support for using the same param name in array of paths (#122)
const router = new UniversalRouter({
path: ['/one/:parameter', '/two/:parameter'],
action: context => context.params,
})
router.resolve('/one/a') // => { parameter: 'a' }
router.resolve('/two/b') // => { parameter: 'b' }
Changelog
[4.0.0] - 2017-09-15
router.resolve({ path })
to router.resolve({ pathname })
(BREAKING CHANGE #114)context.url
to context.pathname
(BREAKING CHANGE #114)pretty
option from generateUrls(router, options)
function in favor of new encode
option
(BREAKING CHANGE #111)/test/
is now treated as /test/
instead of /test
when matching)*
) - use parameters instead ((.*)
)encode
option to generateUrls(router, options)
function for pretty encoding
(e.g. pass your own implementation) (#111)context.keys
values from the parent route (#111)context.params
and queryParams
from
Object
(e.g. params.hasOwnProperty()
won't throw an exception anymore)
(#111)Migration from v3 to v4:
router.resolve({ path, ... })
to router.resolve({ pathname, ... })
path: '/posts/:uri/'
=> path: '/posts/:uri'
path: '/posts/'
=> path: '/posts'
path: '/'
=> path: ''
path: '*'
with path: '(.*)'
if any.js
files to include .mjs
extension, i.e.
test: /\.js$/
=> test: /\.m?js$/
Changelog
[3.2.0] - 2017-05-10
stringifyQueryParams
option to generateUrls(router, options)
to generate URL with
query string from unknown route params
(#93)