File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export class Location {
4141}
4242
4343export function unescapePointerFragment ( fragment : string ) : string {
44- return decodeURIComponent ( fragment ) . replaceAll ( '~1' , '/' ) . replaceAll ( '~0' , '~' ) ;
44+ return decodeURIComponent ( fragment ) . replace ( / ~ 1 / g , '/' ) . replace ( / ~ 0 / g , '~' ) ;
4545}
4646
4747export function escapePointerFragment < T extends string | number > ( fragment : T ) : T {
@@ -52,12 +52,12 @@ export function escapePointerFragment<T extends string | number>(fragment: T): T
5252// RFC 6901: https://datatracker.ietf.org/doc/html/rfc6901#section-6
5353function encodeURIFragmentIdentifier ( fragment : string ) : string {
5454 return fragment
55- . replaceAll ( '%' , '%25' )
56- . replaceAll ( '^' , '%5E' )
57- . replaceAll ( '|' , '%7C' )
58- . replaceAll ( ' \\\\' , '%5C' )
59- . replaceAll ( '\\' , '%22' )
60- . replaceAll ( ' ' , '%20' ) ;
55+ . replace ( / % / g , '%25' )
56+ . replace ( / ^ / g , '%5E' )
57+ . replace ( / | / g , '%7C' )
58+ . replace ( / \\ \\ / g , '%5C' )
59+ . replace ( / \\ / g , '%22' )
60+ . replace ( / / g , '%20' ) ;
6161}
6262
6363export function parseRef ( ref : string ) : { uri : string | null ; pointer : string [ ] } {
You can’t perform that action at this time.
0 commit comments