@whitesev/utils 2.3.1 → 2.3.3
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/dist/index.amd.js +34 -6
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +34 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +34 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +34 -6
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +34 -6
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +34 -6
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Httpx.d.ts +62 -12
- package/dist/types/src/Utils.d.ts +9 -0
- package/package.json +1 -1
- package/src/Httpx.ts +117 -38
- package/src/Utils.ts +39 -11
package/dist/index.system.js
CHANGED
|
@@ -1758,6 +1758,8 @@ System.register('Utils', [], (function (exports) {
|
|
|
1758
1758
|
data: details.data || this.context.#defaultDetails.data,
|
|
1759
1759
|
redirect: details.redirect || this.context.#defaultDetails.redirect,
|
|
1760
1760
|
cookie: details.cookie || this.context.#defaultDetails.cookie,
|
|
1761
|
+
cookiePartition: details.cookiePartition ||
|
|
1762
|
+
this.context.#defaultDetails.cookiePartition,
|
|
1761
1763
|
binary: details.binary || this.context.#defaultDetails.binary,
|
|
1762
1764
|
nocache: details.nocache || this.context.#defaultDetails.nocache,
|
|
1763
1765
|
revalidate: details.revalidate || this.context.#defaultDetails.revalidate,
|
|
@@ -1859,6 +1861,15 @@ System.register('Utils', [], (function (exports) {
|
|
|
1859
1861
|
else {
|
|
1860
1862
|
result.fetchInit = details.fetchInit;
|
|
1861
1863
|
}
|
|
1864
|
+
// 处理新的cookiePartition
|
|
1865
|
+
if (typeof result.cookiePartition === "object" &&
|
|
1866
|
+
result.cookiePartition != null) {
|
|
1867
|
+
if (Reflect.has(result.cookiePartition, "topLevelSite") &&
|
|
1868
|
+
typeof result.cookiePartition.topLevelSite !== "string") {
|
|
1869
|
+
// topLevelSite必须是字符串
|
|
1870
|
+
Reflect.deleteProperty(result.cookiePartition, "topLevelSite");
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1862
1873
|
return result;
|
|
1863
1874
|
},
|
|
1864
1875
|
/**
|
|
@@ -2348,6 +2359,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
2348
2359
|
data: void 0,
|
|
2349
2360
|
redirect: void 0,
|
|
2350
2361
|
cookie: void 0,
|
|
2362
|
+
cookiePartition: void 0,
|
|
2351
2363
|
binary: void 0,
|
|
2352
2364
|
nocache: void 0,
|
|
2353
2365
|
revalidate: void 0,
|
|
@@ -3931,7 +3943,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
3931
3943
|
this.windowApi = new WindowApi(option);
|
|
3932
3944
|
}
|
|
3933
3945
|
/** 版本号 */
|
|
3934
|
-
version = "2024.9.
|
|
3946
|
+
version = "2024.9.28";
|
|
3935
3947
|
addStyle(cssText) {
|
|
3936
3948
|
if (typeof cssText !== "string") {
|
|
3937
3949
|
throw new Error("Utils.addStyle 参数cssText 必须为String类型");
|
|
@@ -6444,13 +6456,29 @@ System.register('Utils', [], (function (exports) {
|
|
|
6444
6456
|
* > ()=>{throw new Error('测试错误')}出现错误
|
|
6445
6457
|
*/
|
|
6446
6458
|
tryCatch = TryCatch;
|
|
6447
|
-
uniqueArray(uniqueArrayData = [], compareArrayData
|
|
6448
|
-
// @ts-ignore
|
|
6459
|
+
uniqueArray(uniqueArrayData = [], compareArrayData, compareFun = (item, item2) => {
|
|
6449
6460
|
return item === item2;
|
|
6450
6461
|
}) {
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6462
|
+
if (typeof compareArrayData === "function") {
|
|
6463
|
+
const compareFn = compareArrayData;
|
|
6464
|
+
const seen = new Set();
|
|
6465
|
+
const result = [];
|
|
6466
|
+
for (const item of uniqueArrayData) {
|
|
6467
|
+
// 使用compareFn函数来获取当前对象的唯一标识
|
|
6468
|
+
const identfier = compareFn(item);
|
|
6469
|
+
// 如果Set中还没有这个标识,则添加到结果数组中,并将其标识存入Set
|
|
6470
|
+
if (!seen.has(identfier)) {
|
|
6471
|
+
seen.add(identfier);
|
|
6472
|
+
result.push(item);
|
|
6473
|
+
}
|
|
6474
|
+
}
|
|
6475
|
+
return result;
|
|
6476
|
+
}
|
|
6477
|
+
else {
|
|
6478
|
+
return Array.from(uniqueArrayData).filter((item) => !Array.from(compareArrayData).some(function (item2) {
|
|
6479
|
+
return compareFun(item, item2);
|
|
6480
|
+
}));
|
|
6481
|
+
}
|
|
6454
6482
|
}
|
|
6455
6483
|
waitArrayLoopToEnd(data, handleFunc) {
|
|
6456
6484
|
let UtilsContext = this;
|