Skip to content

Commit 30e2676

Browse files
author
Anatoly Ostrovsky
committed
Fix url matcher bug
1 parent 064bc0c commit 30e2676

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/router/url/url-matcher.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class UrlMatcher {
110110
const staticSegments = matcher._segments;
111111

112112
const pathParams = matcher._params.filter(
113-
(param) => param.location === DefType.PATH,
113+
(p) => p.location === DefType.PATH,
114114
);
115115

116116
return arrayTuples(staticSegments, pathParams.concat(undefined))
@@ -120,7 +120,7 @@ export class UrlMatcher {
120120

121121
/** @internal Given a matcher, return an array with the matcher's query params */
122122
static queryParams(matcher) {
123-
return matcher._params.filter((param) => param.location === DefType.SEARCH);
123+
return matcher._params.filter((p) => p.location === DefType.SEARCH);
124124
}
125125

126126
/**
@@ -257,13 +257,13 @@ export class UrlMatcher {
257257

258258
// Split into static segments separated by path parameter placeholders.
259259
// The number of segments is always 1 more than the number of parameters.
260-
const matchDetails = (match, isSearch) => {
260+
const matchDetails = (m, isSearch) => {
261261
// IE[78] returns '' for unmatched groups instead of null
262-
const id = match[2] || match[3];
262+
const id = m[2] || m[3];
263263

264264
const regexp = isSearch
265-
? match[4]
266-
: match[4] || (match[1] === "*" ? "[\\s\\S]*" : null);
265+
? m[4]
266+
: m[4] || (m[1] === "*" ? "[\\s\\S]*" : null);
267267

268268
const makeRegexpType = (str) =>
269269
inherit(paramTypes.type(isSearch ? "query" : "path"), {
@@ -276,7 +276,7 @@ export class UrlMatcher {
276276
return {
277277
id,
278278
regexp,
279-
segment: pattern.substring(last, match.index),
279+
segment: pattern.substring(last, m.index),
280280
type: !regexp
281281
? null
282282
: paramTypes.type(regexp) || makeRegexpType(regexp),
@@ -602,7 +602,7 @@ export class UrlMatcher {
602602

603603
let { encoded } = paramDetails;
604604

605-
if (isNull(encoded) || (isDefaultValue && squash !== false))
605+
if (isNullOrUndefined(encoded) || (isDefaultValue && squash !== false))
606606
return undefined;
607607

608608
if (!Array.isArray(encoded)) encoded = [encoded];

0 commit comments

Comments
 (0)