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