@whitesev/utils 2.5.0 → 2.5.2
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 +10 -2
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +10 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +10 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +10 -2
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +10 -2
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +10 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/types/src/Httpx.d.ts +1 -1
- package/dist/types/src/Utils.d.ts +1 -1
- package/package.json +1 -1
- package/src/Httpx.ts +1 -1
- package/src/Utils.ts +11 -4
|
@@ -101,7 +101,7 @@ declare class Httpx {
|
|
|
101
101
|
* @param url 网址
|
|
102
102
|
* @param details 配置
|
|
103
103
|
*/
|
|
104
|
-
post<T
|
|
104
|
+
post<T extends HttpxRequestOption>(url: string, details: T): HttpxPromise<HttpxResponse<T>>;
|
|
105
105
|
/**
|
|
106
106
|
* HEAD 请求
|
|
107
107
|
* @param details 配置
|
|
@@ -82,7 +82,7 @@ declare class Utils {
|
|
|
82
82
|
* 复制formData数据
|
|
83
83
|
* @param formData 需要clone的数据
|
|
84
84
|
*/
|
|
85
|
-
cloneFormData<T extends FormData>(formData: T): T;
|
|
85
|
+
cloneFormData<T extends FormData>(formData: T, filterFn?: (key: string, value: string | Blob) => boolean): T;
|
|
86
86
|
/**
|
|
87
87
|
* 函数重载实现
|
|
88
88
|
* @example
|
package/package.json
CHANGED
package/src/Httpx.ts
CHANGED
package/src/Utils.ts
CHANGED
|
@@ -29,7 +29,7 @@ class Utils {
|
|
|
29
29
|
this.windowApi = new WindowApi(option);
|
|
30
30
|
}
|
|
31
31
|
/** 版本号 */
|
|
32
|
-
version = "2024.11.
|
|
32
|
+
version = "2024.11.16";
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* 在页面中增加style元素,如果html节点存在子节点,添加子节点第一个,反之,添加到html节点的子节点最后一个
|
|
@@ -309,10 +309,17 @@ class Utils {
|
|
|
309
309
|
* 复制formData数据
|
|
310
310
|
* @param formData 需要clone的数据
|
|
311
311
|
*/
|
|
312
|
-
cloneFormData<T extends FormData>(
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
cloneFormData<T extends FormData>(
|
|
313
|
+
formData: T,
|
|
314
|
+
filterFn?: (key: string, value: string | Blob) => boolean
|
|
315
|
+
): T {
|
|
316
|
+
let clonedFormData = new FormData() as T;
|
|
315
317
|
for (let [key, value] of (formData as any).entries()) {
|
|
318
|
+
let isFilter =
|
|
319
|
+
typeof filterFn === "function" ? filterFn(key, value) : false;
|
|
320
|
+
if (typeof isFilter === "boolean" && isFilter) {
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
316
323
|
clonedFormData.append(key, value);
|
|
317
324
|
}
|
|
318
325
|
return clonedFormData;
|