@etsoo/shared 1.2.48 → 1.2.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/Utils.ts +7 -0
- package/lib/cjs/Utils.js +2 -1
- package/lib/mjs/Utils.js +2 -1
- package/package.json +1 -1
- package/src/Utils.ts +2 -1
package/__tests__/Utils.ts
CHANGED
|
@@ -46,6 +46,13 @@ describe('Tests for addUrlParams', () => {
|
|
|
46
46
|
);
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
+
const result22 = '/'.addUrlParams(data);
|
|
50
|
+
test('addUrlParams with relative path', () => {
|
|
51
|
+
expect(result22).toBe(
|
|
52
|
+
'/?a=a&b=false&c=123&d=2022-01-28T10%3A00%3A00.000Z&e=1&e=2&f=a&f=b&g='
|
|
53
|
+
);
|
|
54
|
+
});
|
|
55
|
+
|
|
49
56
|
global.URL = undefined as any;
|
|
50
57
|
|
|
51
58
|
const result3 = url.addUrlParams(data);
|
package/lib/cjs/Utils.js
CHANGED
|
@@ -23,7 +23,8 @@ String.prototype.addUrlParams = function (data, arrayFormat) {
|
|
|
23
23
|
}
|
|
24
24
|
return url + data;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
// Simple check
|
|
27
|
+
if (typeof URL === 'undefined' || !this.includes('://')) {
|
|
27
28
|
const params = Object.entries(data)
|
|
28
29
|
.map(([key, value]) => {
|
|
29
30
|
let v;
|
package/lib/mjs/Utils.js
CHANGED
|
@@ -17,7 +17,8 @@ String.prototype.addUrlParams = function (data, arrayFormat) {
|
|
|
17
17
|
}
|
|
18
18
|
return url + data;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
// Simple check
|
|
21
|
+
if (typeof URL === 'undefined' || !this.includes('://')) {
|
|
21
22
|
const params = Object.entries(data)
|
|
22
23
|
.map(([key, value]) => {
|
|
23
24
|
let v;
|
package/package.json
CHANGED
package/src/Utils.ts
CHANGED
|
@@ -135,7 +135,8 @@ String.prototype.addUrlParams = function (
|
|
|
135
135
|
return url + data;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
// Simple check
|
|
139
|
+
if (typeof URL === 'undefined' || !this.includes('://')) {
|
|
139
140
|
const params = Object.entries(data)
|
|
140
141
|
.map(([key, value]) => {
|
|
141
142
|
let v: string;
|