Skip to content

Commit c9d3445

Browse files
committed
refactor: use a performant alternative to build the '/' route
1 parent a0e8f15 commit c9d3445

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/router/lookup_store/url_builder.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ export class UrlBuilder {
110110
* we must break out from the loop
111111
*/
112112
if (token.type === 0) {
113-
const value = token.val.startsWith('/') ? token.val.substring(1) : token.val
114-
uriSegments.push(`${value}${token.end}`)
113+
uriSegments.push(token.val === '/' ? '' : `${token.val}${token.end}`)
115114
} else if (token.type === 2) {
116115
const values: string[] = paramsArray ? paramsArray.slice(paramsIndex) : paramsObject['*']
117116
this.#ensureHasWildCardValues(pattern, values)

0 commit comments

Comments
 (0)