Skip to content

Commit

Permalink
Proposal: unmatched optional path segments should be undefined in p…
Browse files Browse the repository at this point in the history
…rops

Fixes #381.
  • Loading branch information
developit authored Sep 22, 2020
1 parent 63c2592 commit 0ef84fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ export function exec(url, route, opts) {
flags = (route[i].match(/[+*?]+$/) || EMPTY)[0] || '',
plus = ~flags.indexOf('+'),
star = ~flags.indexOf('*'),
val = url[i] || '';
val = url[i];
if (!val && !star && (flags.indexOf('?')<0 || plus)) {
ret = false;
break;
}
matches[param] = decodeURIComponent(val);
matches[param] = val && decodeURIComponent(val);
if (plus || star) {
matches[param] = url.slice(i).map(decodeURIComponent).join('/');
break;
Expand Down

0 comments on commit 0ef84fe

Please sign in to comment.