dlsjs 0.1.24 → 0.1.25

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
@@ -3,7 +3,7 @@
3
3
  "author": "林川",
4
4
  "license": "MIT",
5
5
  "private": false,
6
- "version": "0.1.24",
6
+ "version": "0.1.25",
7
7
  "description": "domain-language for js",
8
8
  "main": "dist/dlsjs.esm.js",
9
9
  "module": "dist/dlsjs.esm.js",
@@ -22,6 +22,12 @@ export function list2Tree (list, extendProps = {}) {
22
22
  ...extendProps
23
23
  };
24
24
 
25
+ // 校验数据结构
26
+ if(list[0] && !list[0].hasOwnProperty('id')) {
27
+ console.warn('数据非标准,未找到唯一标识字段,直接返回')
28
+ return list
29
+ }
30
+
25
31
  const { id: idKey, children: childrenKey, parentId: parentIdKey, useConcat } = props;
26
32
 
27
33
  // 2. 构建ID到节点的哈希映射(O(n)),同时初始化children数组