Skip to content

Commit

Permalink
minor stylistic tweak - avoid intermediate values unless needed for c…
Browse files Browse the repository at this point in the history
…omprehension etc
  • Loading branch information
Rich-Harris committed Jan 30, 2023
1 parent 6de7e41 commit fda3524
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/kit/src/utils/routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ export function exec(match, params, matchers) {
// in the `[[a=b]]/.../[...rest]` case, if one or more optional parameters
// weren't matched, roll the skipped values into the rest
if (param.chained && param.rest && buffered) {
const bufferedValues = values.slice(i - buffered, i + 1);
result[param.name] = bufferedValues.filter((s) => s).join('/');
result[param.name] = values
.slice(i - buffered, i + 1)
.filter((s) => s)
.join('/');

buffered = 0;
continue;
}
Expand Down

0 comments on commit fda3524

Please sign in to comment.