@@ -42,64 +42,6 @@ export const buildURL = (opts) => {
42
42
return urlObj . href ;
43
43
}
44
44
45
- export const buildURLs = ( opts ) => {
46
- if ( ! opts . path && ! opts . src ) {
47
- return "" ;
48
- }
49
-
50
- //Create correct query parameters
51
- var parsedURL , isSrcParameterUsedForURL , parsedHost ;
52
- if ( opts . path ) {
53
- parsedURL = new URL ( pathJoin ( [ opts . urlEndpoint , opts . path ] ) ) ;
54
- parsedHost = new URL ( opts . urlEndpoint ) ;
55
- } else {
56
- parsedURL = new URL ( opts . src ) ;
57
- isSrcParameterUsedForURL = true ;
58
- }
59
-
60
- var queryParameters = new URLSearchParams ( parsedURL . query || "" ) ;
61
- if ( opts . sdkVersion && opts . sdkVersion . trim ( ) != "" ) {
62
- queryParameters . append ( "ik-sdk-version" , opts . sdkVersion . trim ( ) ) ;
63
- }
64
- for ( var i in opts . queryParameters ) {
65
- queryParameters . append ( i , opts . queryParameters [ i ] ) ;
66
- }
67
-
68
- //Initial URL Construction Object
69
- var urlObject = { host : "" , pathname : "" , search : "" } ;
70
- if ( opts . path ) {
71
- urlObject . protocol = parsedHost . protocol ;
72
- urlObject . host = opts . urlEndpoint . replace ( urlObject . protocol + "//" , "" ) ;
73
- } else if ( opts . src ) {
74
- urlObject . host = [ parsedURL . auth , parsedURL . auth ? "@" : "" , parsedURL . host ] . join ( "" ) ;
75
- urlObject . protocol = parsedURL . protocol ;
76
- }
77
- urlObject . pathname = parsedURL . pathname ;
78
-
79
- //Create Transformation String
80
- var transformationString = constructTransformationString ( opts . transformation ) ;
81
- if ( transformationString ) {
82
- //force that if src parameter is being used for URL construction then the transformation
83
- //string should be added only as a query parameter
84
- if ( transformationUtils . addAsQueryParameter ( opts ) || isSrcParameterUsedForURL ) {
85
- queryParameters . append ( TRANSFORMATION_PARAMETER , transformationString ) ;
86
- } else {
87
- urlObject . pathname = pathJoin ( [
88
- TRANSFORMATION_PARAMETER ,
89
- transformationUtils . getChainTransformDelimiter ( ) ,
90
- transformationString ,
91
- urlObject . pathname
92
- ] ) ;
93
- }
94
- }
95
-
96
- urlObject . host = removeTrailingSlash ( urlObject . host ) ;
97
- urlObject . pathname = addLeadingSlash ( urlObject . pathname ) ;
98
- urlObject . search = queryParameters . toString ( ) ;
99
-
100
- return url . format ( urlObject ) ;
101
- } ;
102
-
103
45
function constructTransformationString ( transformation ) {
104
46
if ( ! Array . isArray ( transformation ) ) { return "" ; }
105
47
@@ -130,14 +72,6 @@ function constructTransformationString(transformation) {
130
72
return parsedTransforms . join ( transformationUtils . getChainTransformDelimiter ( ) ) ;
131
73
}
132
74
133
- function addLeadingSlash ( str ) {
134
- if ( typeof str == "string" && str [ 0 ] != "/" ) {
135
- str = "/" + str ;
136
- }
137
-
138
- return str ;
139
- }
140
-
141
75
function removeTrailingSlash ( str ) {
142
76
if ( typeof str == "string" && str [ str . length - 1 ] == "/" ) {
143
77
str = str . substring ( 0 , str . length - 1 ) ;
0 commit comments