@leafer/data 1.6.2 → 1.6.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leafer/data",
3
- "version": "1.6.2",
3
+ "version": "1.6.4",
4
4
  "description": "@leafer/data",
5
5
  "author": "Chao (Leafer) Wan",
6
6
  "license": "MIT",
@@ -22,6 +22,6 @@
22
22
  "leaferjs"
23
23
  ],
24
24
  "devDependencies": {
25
- "@leafer/interface": "1.6.2"
25
+ "@leafer/interface": "1.6.4"
26
26
  }
27
27
  }
package/src/DataHelper.ts CHANGED
@@ -37,6 +37,11 @@ export const DataHelper = {
37
37
  const map = {} as IBooleanMap
38
38
  for (let i = 0, len = list.length; i < len; i++) map[list[i]] = true
39
39
  return map
40
+ },
41
+
42
+ stintSet(data: IObject, attrName: string, value: any): void {
43
+ value || (value = undefined)
44
+ data[attrName] !== value && (data[attrName] = value) // 只有值不一样时才设置,节省内存开销
40
45
  }
41
46
 
42
47
  }
package/types/index.d.ts CHANGED
@@ -6,6 +6,7 @@ declare const DataHelper: {
6
6
  copyAttrs(t: IObject, from: IObject, include: string[]): IObject;
7
7
  clone(data: unknown): IObject;
8
8
  toMap(list: string[]): IBooleanMap;
9
+ stintSet(data: IObject, attrName: string, value: any): void;
9
10
  };
10
11
 
11
12
  declare class LeafData implements ILeafData {