tree-processor 0.6.0 → 0.6.1
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/README.md +16 -16
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/stats.html +1 -1
- package/dist/tree-processor.cjs.js +2 -2
- package/dist/tree-processor.esm.js +4 -4
- package/dist/tree-processor.umd.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
一个轻量级的树结构数据处理工具库,使用 TypeScript 编写,支持 tree-shaking,每个格式打包体积约 **3-4 KB**(ESM: 3.25 KB,CJS: 3.42 KB,UMD: 3.56 KB)。
|
|
4
4
|
|
|
5
|
-
目前已支持 mapTree、forEachTree、filterTree、findTree、pushTree、unshiftTree、popTree、shiftTree、someTree、everyTree、includesTree、atTree、indexOfTree、atIndexOfTree、getParentTree、nodeDepthMap、dedupTree、removeTree、isEmptyTree、
|
|
5
|
+
目前已支持 mapTree、forEachTree、filterTree、findTree、pushTree、unshiftTree、popTree、shiftTree、someTree、everyTree、includesTree、atTree、indexOfTree、atIndexOfTree、getParentTree、nodeDepthMap、dedupTree、removeTree、isEmptyTree、isSingleTree 和 isMultipleTrees。每个方法的最后一个参数可以自定义 children 和 id 的属性名。
|
|
6
6
|
|
|
7
7
|
## ✨ 特性
|
|
8
8
|
|
|
@@ -280,12 +280,12 @@ const isEmpty = t.isEmptyTree(treeData)
|
|
|
280
280
|
console.log(isEmpty) // true 表示树为空,false 表示树不为空
|
|
281
281
|
```
|
|
282
282
|
|
|
283
|
-
###
|
|
283
|
+
### isSingleTree(判断数据是否是单个树结构)
|
|
284
284
|
|
|
285
|
-
|
|
285
|
+
判断数据是否是单个树结构(单个对象)。树结构必须是一个对象(不能是数组、null、undefined 或基本类型),如果存在 children 字段,必须是数组类型,并且会递归检查所有子节点。
|
|
286
286
|
|
|
287
287
|
```javascript
|
|
288
|
-
//
|
|
288
|
+
// 有效的单个树结构
|
|
289
289
|
const tree = {
|
|
290
290
|
id: 1,
|
|
291
291
|
name: 'node1',
|
|
@@ -295,7 +295,7 @@ const tree = {
|
|
|
295
295
|
],
|
|
296
296
|
};
|
|
297
297
|
|
|
298
|
-
const isValid = t.
|
|
298
|
+
const isValid = t.isSingleTree(tree)
|
|
299
299
|
console.log(isValid) // true
|
|
300
300
|
|
|
301
301
|
// 无效的树结构
|
|
@@ -304,7 +304,7 @@ const invalidTree = {
|
|
|
304
304
|
children: null, // children 不能是 null
|
|
305
305
|
};
|
|
306
306
|
|
|
307
|
-
const isInvalid = t.
|
|
307
|
+
const isInvalid = t.isSingleTree(invalidTree)
|
|
308
308
|
console.log(isInvalid) // false
|
|
309
309
|
|
|
310
310
|
// 支持自定义字段名
|
|
@@ -317,16 +317,16 @@ const customTree = {
|
|
|
317
317
|
};
|
|
318
318
|
|
|
319
319
|
const fieldNames = { children: 'subNodes', id: 'nodeId' };
|
|
320
|
-
const isValidCustom = t.
|
|
320
|
+
const isValidCustom = t.isSingleTree(customTree, fieldNames)
|
|
321
321
|
console.log(isValidCustom) // true
|
|
322
322
|
```
|
|
323
323
|
|
|
324
|
-
###
|
|
324
|
+
### isMultipleTrees(判断数据是否是多个树结构)
|
|
325
325
|
|
|
326
|
-
|
|
326
|
+
判断数据是否是多个树结构(数组)。多个树结构必须是一个数组,数组中的每个元素都必须是有效的单个树结构。
|
|
327
327
|
|
|
328
328
|
```javascript
|
|
329
|
-
//
|
|
329
|
+
// 有效的多个树结构
|
|
330
330
|
const forest = [
|
|
331
331
|
{
|
|
332
332
|
id: 1,
|
|
@@ -342,21 +342,21 @@ const forest = [
|
|
|
342
342
|
},
|
|
343
343
|
];
|
|
344
344
|
|
|
345
|
-
const isValid = t.
|
|
345
|
+
const isValid = t.isMultipleTrees(forest)
|
|
346
346
|
console.log(isValid) // true
|
|
347
347
|
|
|
348
|
-
//
|
|
348
|
+
// 空数组也是有效的多个树结构
|
|
349
349
|
const emptyForest = []
|
|
350
|
-
const isEmptyValid = t.
|
|
350
|
+
const isEmptyValid = t.isMultipleTrees(emptyForest)
|
|
351
351
|
console.log(isEmptyValid) // true
|
|
352
352
|
|
|
353
|
-
//
|
|
353
|
+
// 无效的多个树结构
|
|
354
354
|
const invalidForest = [
|
|
355
355
|
{ id: 1, children: [{ id: 2 }] },
|
|
356
356
|
'not a tree', // 数组元素必须是树结构
|
|
357
357
|
];
|
|
358
358
|
|
|
359
|
-
const isInvalid = t.
|
|
359
|
+
const isInvalid = t.isMultipleTrees(invalidForest)
|
|
360
360
|
console.log(isInvalid) // false
|
|
361
361
|
|
|
362
362
|
// 支持自定义字段名
|
|
@@ -371,7 +371,7 @@ const customForest = [
|
|
|
371
371
|
];
|
|
372
372
|
|
|
373
373
|
const fieldNames = { children: 'subNodes', id: 'nodeId' };
|
|
374
|
-
const isValidCustom = t.
|
|
374
|
+
const isValidCustom = t.isMultipleTrees(customForest, fieldNames)
|
|
375
375
|
console.log(isValidCustom) // true
|
|
376
376
|
```
|
|
377
377
|
|
package/dist/index.d.ts
CHANGED
|
@@ -23,8 +23,8 @@ export declare function forEachTree(tree: TreeData, callback: (node: TreeNode) =
|
|
|
23
23
|
export declare function isEmptyTree(tree: TreeData): boolean;
|
|
24
24
|
export declare function getParentTree(tree: TreeData, targetId: any, fieldNames?: FieldNames): TreeNode | null;
|
|
25
25
|
export declare function includesTree(tree: TreeData, targetId: any, fieldNames?: FieldNames): boolean;
|
|
26
|
-
export declare function
|
|
27
|
-
export declare function
|
|
26
|
+
export declare function isSingleTree(data: any, fieldNames?: FieldNames): boolean;
|
|
27
|
+
export declare function isMultipleTrees(data: any, fieldNames?: FieldNames): boolean;
|
|
28
28
|
declare const treeProcessor: {
|
|
29
29
|
mapTree: typeof mapTree;
|
|
30
30
|
filterTree: typeof filterTree;
|
|
@@ -45,8 +45,8 @@ declare const treeProcessor: {
|
|
|
45
45
|
isEmptyTree: typeof isEmptyTree;
|
|
46
46
|
getParentTree: typeof getParentTree;
|
|
47
47
|
includesTree: typeof includesTree;
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
isSingleTree: typeof isSingleTree;
|
|
49
|
+
isMultipleTrees: typeof isMultipleTrees;
|
|
50
50
|
};
|
|
51
51
|
export default treeProcessor;
|
|
52
52
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;CACZ;AAaD,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAK3C,MAAM,MAAM,QAAQ,GAAG,QAAQ,EAAE,CAAC;AASlC,wBAAgB,OAAO,CACrB,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,GAAG,EACjC,UAAU,GAAE,UAAgC,GAC3C,GAAG,EAAE,CAeP;AASD,wBAAgB,UAAU,CACxB,IAAI,EAAE,QAAQ,EACd,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,EACpD,UAAU,GAAE,UAAgC,GAC3C,QAAQ,CAiBV;AASD,wBAAgB,QAAQ,CACtB,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,EACxC,UAAU,GAAE,UAAgC,GAC3C,QAAQ,GAAG,IAAI,CAcjB;AAUD,wBAAgB,QAAQ,CACtB,IAAI,EAAE,QAAQ,EACd,cAAc,EAAE,GAAG,EACnB,OAAO,EAAE,QAAQ,EACjB,UAAU,GAAE,UAAgC,GAC3C,OAAO,CAqBT;AAUD,wBAAgB,WAAW,CACzB,IAAI,EAAE,QAAQ,EACd,cAAc,EA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exports) {
|
|
|
4929
4929
|
</script>
|
|
4930
4930
|
<script>
|
|
4931
4931
|
/*<!--*/
|
|
4932
|
-
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tree-processor.
|
|
4932
|
+
const data = {"version":2,"tree":{"name":"root","children":[{"name":"tree-processor.umd.js","children":[{"name":"src/index.ts","uid":"10314601-1"}]}],"isRoot":true},"nodeParts":{"10314601-1":{"renderedLength":12266,"gzipLength":1681,"brotliLength":1475,"metaUid":"10314601-0"}},"nodeMetas":{"10314601-0":{"id":"\\src\\index.ts","moduleParts":{"tree-processor.umd.js":"10314601-1"},"imported":[],"importedBy":[],"isEntry":true}},"env":{"rollup":"4.56.0"},"options":{"gzip":true,"brotli":true,"sourcemap":false}};
|
|
4933
4933
|
|
|
4934
4934
|
const run = () => {
|
|
4935
4935
|
const width = window.innerWidth;
|
|
@@ -66,5 +66,5 @@ if(void 0!==t){if(null===t)return!1
|
|
|
66
66
|
if(!Array.isArray(t))return!1
|
|
67
67
|
for(const r of t)if(!m(r,e))return!1}return!0}function v(n,e=r){if(!Array.isArray(n))return!1
|
|
68
68
|
for(const r of n)if(!m(r,e))return!1
|
|
69
|
-
return!0}const
|
|
70
|
-
exports.atIndexOfTree=a,exports.atTree=l,exports.dedupTree=y,exports.default=
|
|
69
|
+
return!0}const M={mapTree:n,filterTree:e,findTree:t,pushTree:i,unshiftTree:o,popTree:s,shiftTree:u,someTree:f,everyTree:c,atTree:l,indexOfTree:h,atIndexOfTree:a,nodeDepthMap:d,dedupTree:y,removeTree:A,forEachTree:p,isEmptyTree:T,getParentTree:g,includesTree:x,isSingleTree:m,isMultipleTrees:v}
|
|
70
|
+
exports.atIndexOfTree=a,exports.atTree=l,exports.dedupTree=y,exports.default=M,exports.everyTree=c,exports.filterTree=e,exports.findTree=t,exports.forEachTree=p,exports.getParentTree=g,exports.includesTree=x,exports.indexOfTree=h,exports.isEmptyTree=T,exports.isMultipleTrees=v,exports.isSingleTree=m,exports.mapTree=n,exports.nodeDepthMap=d,exports.popTree=s,exports.pushTree=i,exports.removeTree=A,exports.shiftTree=u,exports.someTree=f,exports.unshiftTree=o
|
|
@@ -18,9 +18,9 @@ if(Array.isArray(n)&&n.length>0&&r(n))return!0}return!1}(n)}function u(n,t,e=r){
|
|
|
18
18
|
return!!(Array.isArray(r)&&r.length>0)&&(r.shift(),!0)}const n=i[e.children]
|
|
19
19
|
if(Array.isArray(n)&&n.length>0&&r(n))return!0}return!1}(n)}function f(n,t,e=r){for(const r of n){if(t(r))return!0
|
|
20
20
|
const n=r[e.children]
|
|
21
|
-
if(Array.isArray(n)&&n.length>0&&f(n,t,e))return!0}return!1}function
|
|
21
|
+
if(Array.isArray(n)&&n.length>0&&f(n,t,e))return!0}return!1}function l(n,t,e=r){for(const r of n){if(!t(r))return!1
|
|
22
22
|
const n=r[e.children]
|
|
23
|
-
if(Array.isArray(n)&&n.length>0&&!
|
|
23
|
+
if(Array.isArray(n)&&n.length>0&&!l(n,t,e))return!1}return!0}function s(n,t,e,i=r){const o=function r(n){for(const e of n){if(e[i.id]===t)return e
|
|
24
24
|
const n=e[i.children]
|
|
25
25
|
if(Array.isArray(n)&&n.length>0){const t=r(n)
|
|
26
26
|
if(t)return t}}return null}(n)
|
|
@@ -64,5 +64,5 @@ if(void 0!==e){if(null===e)return!1
|
|
|
64
64
|
if(!Array.isArray(e))return!1
|
|
65
65
|
for(const r of e)if(!v(r,t))return!1}return!0}function x(n,t=r){if(!Array.isArray(n))return!1
|
|
66
66
|
for(const r of n)if(!v(r,t))return!1
|
|
67
|
-
return!0}const E={mapTree:n,filterTree:t,findTree:e,pushTree:i,unshiftTree:o,popTree:c,shiftTree:u,someTree:f,everyTree:
|
|
68
|
-
export{a as atIndexOfTree,
|
|
67
|
+
return!0}const E={mapTree:n,filterTree:t,findTree:e,pushTree:i,unshiftTree:o,popTree:c,shiftTree:u,someTree:f,everyTree:l,atTree:s,indexOfTree:h,atIndexOfTree:a,nodeDepthMap:y,dedupTree:d,removeTree:A,forEachTree:g,isEmptyTree:T,getParentTree:p,includesTree:m,isSingleTree:v,isMultipleTrees:x}
|
|
68
|
+
export{a as atIndexOfTree,s as atTree,d as dedupTree,E as default,l as everyTree,t as filterTree,e as findTree,g as forEachTree,p as getParentTree,m as includesTree,h as indexOfTree,T as isEmptyTree,x as isMultipleTrees,v as isSingleTree,n as mapTree,y as nodeDepthMap,c as popTree,i as pushTree,A as removeTree,u as shiftTree,f as someTree,o as unshiftTree}
|
|
@@ -65,5 +65,5 @@ if(void 0!==t){if(null===t)return!1
|
|
|
65
65
|
if(!Array.isArray(t))return!1
|
|
66
66
|
for(const r of t)if(!x(r,e))return!1}return!0}function b(r,e=n){if(!Array.isArray(r))return!1
|
|
67
67
|
for(const n of r)if(!x(n,e))return!1
|
|
68
|
-
return!0}const
|
|
69
|
-
r.atIndexOfTree=d,r.atTree=h,r.dedupTree=A,r.default=
|
|
68
|
+
return!0}const M={mapTree:e,filterTree:t,findTree:i,pushTree:o,unshiftTree:f,popTree:u,shiftTree:c,someTree:s,everyTree:l,atTree:h,indexOfTree:a,atIndexOfTree:d,nodeDepthMap:y,dedupTree:A,removeTree:T,forEachTree:g,isEmptyTree:p,getParentTree:m,includesTree:v,isSingleTree:x,isMultipleTrees:b}
|
|
69
|
+
r.atIndexOfTree=d,r.atTree=h,r.dedupTree=A,r.default=M,r.everyTree=l,r.filterTree=t,r.findTree=i,r.forEachTree=g,r.getParentTree=m,r.includesTree=v,r.indexOfTree=a,r.isEmptyTree=p,r.isMultipleTrees=b,r.isSingleTree=x,r.mapTree=e,r.nodeDepthMap=y,r.popTree=u,r.pushTree=o,r.removeTree=T,r.shiftTree=c,r.someTree=s,r.unshiftTree=f,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tree-processor",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "A lightweight TypeScript library for processing tree-structured data with comprehensive methods (map, filter, find, push, pop, remove, getParent, includes, etc.), supporting tree-shaking and custom field names",
|
|
5
5
|
"main": "dist/tree-processor.cjs.js",
|
|
6
6
|
"module": "dist/tree-processor.esm.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"every",
|
|
43
43
|
"at",
|
|
44
44
|
"indexOf",
|
|
45
|
-
"
|
|
45
|
+
"deduplicate",
|
|
46
46
|
"tree-processor"
|
|
47
47
|
],
|
|
48
48
|
"author": "",
|