Skip to content
This repository was archived by the owner on Feb 25, 2020. It is now read-only.

Commit fa8b320

Browse files
authored
Merge pull request #9 from jaulz/patch-1
fix: avoid stringified "null" and "undefined" values
2 parents 330ebf5 + 2a1793c commit fa8b320

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/routers/pathUtils.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ export const getParamsFromPath = (inputParams, pathMatch, pathMatchKeys) => {
1717
const paramName = key.name;
1818

1919
let decodedMatchResult;
20-
try {
21-
decodedMatchResult = decodeURIComponent(matchResult);
22-
} catch (e) {
23-
// ignore `URIError: malformed URI`
20+
if (matchResult) {
21+
try {
22+
decodedMatchResult = decodeURIComponent(matchResult);
23+
} catch (e) {
24+
// ignore `URIError: malformed URI`
25+
}
2426
}
2527

2628
paramsOut[paramName] = decodedMatchResult || matchResult;

0 commit comments

Comments
 (0)