Skip to content

Commit e441a7c

Browse files
lint(UrlMatcher): Fix TS lint error
1 parent 86e07ef commit e441a7c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/url/urlMatcher.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -418,18 +418,19 @@ export class UrlMatcher {
418418
return acc + encodeURIComponent(<string> encoded);
419419
}, "");
420420

421-
// Build the query string by
421+
// Build the query string by applying parameter values (array or regular)
422+
// then mapping to key=value, then flattening and joining using "&"
422423
let queryString = queryParams.map((param: Param) => {
423424
let {squash, encoded, isDefaultValue} = getDetails(param);
424425
if (encoded == null || (isDefaultValue && squash !== false)) return;
425426
if (!isArray(encoded)) encoded = [<string> encoded];
426427
if (encoded.length === 0) return;
427428
if (!param.type.raw) encoded = map(<string[]> encoded, encodeURIComponent);
428429

429-
return encoded.map(val => `${param.id}=${val}`);
430+
return (<string[]> encoded).map(val => `${param.id}=${val}`);
430431
}).filter(identity).reduce(unnestR, []).join("&");
431432

432-
// Concat the pathstring with the queryString (if exists) and the hasString (if exists)
433+
// Concat the pathstring with the queryString (if exists) and the hashString (if exists)
433434
return pathString + (queryString ? `?${queryString}` : "") + (values["#"] ? "#" + values["#"] : "");
434435
}
435436

0 commit comments

Comments
 (0)