@@ -8,17 +8,17 @@ const {
88const { isObject } = require ( './objects' )
99const { isNonEmptyString } = require ( './strings' )
1010
11- const { encodeURIComponent } = globalThis
11+ const { encodeURIComponent : encodeComponent } = globalThis
1212
1313function encodeName ( name ) {
1414 return isNonEmptyString ( name )
15- ? encodeURIComponent ( name ) . replace ( / % 3 A / g, ':' )
15+ ? encodeComponent ( name ) . replace ( / % 3 A / g, ':' )
1616 : ''
1717}
1818
1919function encodeNamespace ( namespace ) {
2020 return isNonEmptyString ( namespace )
21- ? encodeURIComponent ( namespace ) . replace ( / % 3 A / g, ':' ) . replace ( / % 2 F / g, '/' )
21+ ? encodeComponent ( namespace ) . replace ( / % 3 A / g, ':' ) . replace ( / % 2 F / g, '/' )
2222 : ''
2323}
2424
@@ -51,13 +51,13 @@ function encodeQualifiers(qualifiers) {
5151
5252function encodeSubpath ( subpath ) {
5353 return isNonEmptyString ( subpath )
54- ? encodeURIComponent ( subpath ) . replace ( / % 2 F / g, '/' )
54+ ? encodeComponent ( subpath ) . replace ( / % 2 F / g, '/' )
5555 : ''
5656}
5757
5858function encodeVersion ( version ) {
5959 return isNonEmptyString ( version )
60- ? encodeURIComponent ( version ) . replace ( / % 3 A / g, ':' ) . replace ( / % 2 B / g, '+' )
60+ ? encodeComponent ( version ) . replace ( / % 3 A / g, ':' ) . replace ( / % 2 B / g, '+' )
6161 : ''
6262}
6363
@@ -67,11 +67,11 @@ function replacePlusSignWithPercentEncodedSpace(str) {
6767}
6868
6969module . exports = {
70+ encodeComponent,
7071 encodeName,
7172 encodeNamespace,
7273 encodeVersion,
7374 encodeQualifiers,
7475 encodeQualifierParam,
75- encodeSubpath,
76- encodeURIComponent
76+ encodeSubpath
7777}
0 commit comments