File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ export function getSanitizedUrlStringFromUrlObject(url: URLObject): string {
134134 * unconditionally — setting an attribute to `undefined` is a no-op.
135135 */
136136export function getUrlQuery ( query : string | undefined ) : string | undefined {
137- return stripUrlPartPrefix ( query , '?' ) ;
137+ return query ?. replace ( / ^ \? / , '' ) || undefined ;
138138}
139139
140140/**
@@ -145,15 +145,7 @@ export function getUrlQuery(query: string | undefined): string | undefined {
145145 * unconditionally — setting an attribute to `undefined` is a no-op.
146146 */
147147export function getUrlFragment ( fragment : string | undefined ) : string | undefined {
148- return stripUrlPartPrefix ( fragment , '#' ) ;
149- }
150-
151- function stripUrlPartPrefix ( value : string | undefined , prefix : '?' | '#' ) : string | undefined {
152- if ( ! value ) {
153- return undefined ;
154- }
155-
156- return ( value . startsWith ( prefix ) ? value . slice ( 1 ) : value ) || undefined ;
148+ return fragment ?. replace ( / ^ \# / , '' ) || undefined ;
157149}
158150
159151type PartialRequest = {
You can’t perform that action at this time.
0 commit comments