@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.
@@ -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: (target: T) => {
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.7",
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.38.0",
43
- "@rollup/plugin-commonjs": "^28.0.9",
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.27.0",
49
- "caniuse-lite": "^1.0.30001751",
50
- "eslint": "^9.38.0",
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.4.0",
55
- "rollup": "^4.52.5",
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.46.2"
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: (target: T) => {
3572
+ handler: (
3573
+ /**
3574
+ * 该值为返回的data值
3575
+ */
3576
+ target: T
3577
+ ) => {
3573
3578
  /**
3574
3579
  * 是否是需要的属性
3575
3580
  * + `true` 将目标值赋值给data