kopia lustrzana https://github.com/badgen/badgen.net
Remove "/" in plus segment in matchRoute
rodzic
027ecb2ea6
commit
075e0801fa
|
@ -19,7 +19,7 @@ function matchRoute(pattern: string, path: string): RouteArgs {
|
|||
}
|
||||
|
||||
if (flag === '+') {
|
||||
parsedArgs[name] = path.slice(parsedPathSegment.index)
|
||||
parsedArgs[name] = path.slice(parsedPathSegment.index + 1)
|
||||
return parsedArgs
|
||||
}
|
||||
|
||||
|
|
|
@ -34,15 +34,17 @@ tap.test(testRouteMultiRegex, t => {
|
|||
runTest(t, testRouteMultiRegex, suite)
|
||||
})
|
||||
|
||||
const testRoutePlusSegment = '/david/:topic/:user/:repo/:path+'
|
||||
const testRoutePlusSegment = '/david/:topic/:path+'
|
||||
tap.test(testRoutePlusSegment, t => {
|
||||
const suite = {
|
||||
'/david/dep/babel/babel': null,
|
||||
'/david/dep/babel/babel/packages/babel-cli': {
|
||||
'/david/dep': null,
|
||||
'/david/dep/packages/babel-cli': {
|
||||
topic: 'dep',
|
||||
user: 'babel',
|
||||
repo: 'babel',
|
||||
path: '/packages/babel-cli'
|
||||
path: 'packages/babel-cli'
|
||||
},
|
||||
'/david/dep/https://eiyo.com': {
|
||||
topic: 'dep',
|
||||
path: 'https://eiyo.com'
|
||||
}
|
||||
}
|
||||
runTest(t, testRoutePlusSegment, suite)
|
||||
|
|
Ładowanie…
Reference in New Issue