@whitesev/utils 2.9.7 → 2.9.8
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 +5 -2
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.amd.min.js.map +1 -1
- package/dist/index.cjs.js +5 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.cjs.min.js.map +1 -1
- package/dist/index.esm.js +5 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +5 -2
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.iife.min.js.map +1 -1
- package/dist/index.system.js +5 -2
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/dist/index.umd.js +5 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types/src/Utils.d.ts +6 -2
- package/package.json +9 -9
- package/src/CommonUtil.ts +3 -0
- package/src/Utils.ts +7 -2
|
@@ -1425,11 +1425,15 @@ declare class Utils {
|
|
|
1425
1425
|
*/
|
|
1426
1426
|
watchObject(target: any, propertyName: string, getCallBack: (value: any) => void, setCallBack: (value: any) => void): void;
|
|
1427
1427
|
/**
|
|
1428
|
-
*
|
|
1428
|
+
* 深度获取对象的某个属性
|
|
1429
1429
|
* @param target 待获取的对象
|
|
1430
1430
|
* @param handler 获取属性的回调
|
|
1431
1431
|
*/
|
|
1432
|
-
queryProperty<T = any>(target: any, handler: (
|
|
1432
|
+
queryProperty<T = any>(target: any, handler: (
|
|
1433
|
+
/**
|
|
1434
|
+
* 该值为返回的data值
|
|
1435
|
+
*/
|
|
1436
|
+
target: T) => {
|
|
1433
1437
|
/**
|
|
1434
1438
|
* 是否是需要的属性
|
|
1435
1439
|
* + `true` 将目标值赋值给data
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@whitesev/utils",
|
|
4
|
-
"version": "2.9.
|
|
4
|
+
"version": "2.9.8",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "一个常用的工具库",
|
|
7
7
|
"main": "dist/index.cjs.js",
|
|
@@ -39,24 +39,24 @@
|
|
|
39
39
|
"worker-timers": "^8.0.25"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@eslint/js": "^9.
|
|
43
|
-
"@rollup/plugin-commonjs": "^
|
|
42
|
+
"@eslint/js": "^9.39.1",
|
|
43
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
44
44
|
"@rollup/plugin-json": "^6.1.0",
|
|
45
45
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
46
46
|
"@rollup/plugin-terser": "^0.4.4",
|
|
47
47
|
"@rollup/plugin-typescript": "^12.3.0",
|
|
48
|
-
"browserslist": "^4.
|
|
49
|
-
"caniuse-lite": "^1.0.
|
|
50
|
-
"eslint": "^9.
|
|
48
|
+
"browserslist": "^4.28.0",
|
|
49
|
+
"caniuse-lite": "^1.0.30001756",
|
|
50
|
+
"eslint": "^9.39.1",
|
|
51
51
|
"eslint-config-prettier": "^10.1.8",
|
|
52
52
|
"eslint-plugin-compat": "^6.0.2",
|
|
53
53
|
"eslint-plugin-prettier": "^5.5.4",
|
|
54
|
-
"globals": "^16.
|
|
55
|
-
"rollup": "^4.
|
|
54
|
+
"globals": "^16.5.0",
|
|
55
|
+
"rollup": "^4.53.3",
|
|
56
56
|
"rollup-plugin-clear": "^2.0.7",
|
|
57
57
|
"tslib": "^2.8.1",
|
|
58
58
|
"typescript": "^5.9.3",
|
|
59
|
-
"typescript-eslint": "^8.
|
|
59
|
+
"typescript-eslint": "^8.47.0"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"lint": "eslint .",
|
package/src/CommonUtil.ts
CHANGED
|
@@ -235,6 +235,9 @@ class CommonUtil {
|
|
|
235
235
|
toJSON<T = any>(data: string | null, errorCallBack?: (error: Error) => void): T;
|
|
236
236
|
toJSON<T = any>(data: string | null, errorCallBack?: (error: Error) => void): T {
|
|
237
237
|
let result: any = {};
|
|
238
|
+
if (data == null) {
|
|
239
|
+
return result as T;
|
|
240
|
+
}
|
|
238
241
|
if (typeof data === "object") {
|
|
239
242
|
return data as T;
|
|
240
243
|
}
|
package/src/Utils.ts
CHANGED
|
@@ -3563,13 +3563,18 @@ class Utils {
|
|
|
3563
3563
|
}
|
|
3564
3564
|
}
|
|
3565
3565
|
/**
|
|
3566
|
-
*
|
|
3566
|
+
* 深度获取对象的某个属性
|
|
3567
3567
|
* @param target 待获取的对象
|
|
3568
3568
|
* @param handler 获取属性的回调
|
|
3569
3569
|
*/
|
|
3570
3570
|
queryProperty<T = any>(
|
|
3571
3571
|
target: any,
|
|
3572
|
-
handler: (
|
|
3572
|
+
handler: (
|
|
3573
|
+
/**
|
|
3574
|
+
* 该值为返回的data值
|
|
3575
|
+
*/
|
|
3576
|
+
target: T
|
|
3577
|
+
) => {
|
|
3573
3578
|
/**
|
|
3574
3579
|
* 是否是需要的属性
|
|
3575
3580
|
* + `true` 将目标值赋值给data
|