@dadcici/tree-utils
The CICI utility is an integrated tree operation, such as: traversal tree, list-to-tree, tree-to-list, generate branch path based on node ID, and get the level of the node.
Last updated 4 months ago by hello-jack .
MIT · Original npm · Tarball · package.json
$ cnpm install @dadcici/tree-utils 
SYNC missed versions from official npm registry.

@dadcici/tree-utils

The CICI utility is an integrated tree operation, such as: traversal tree, list-to-tree, tree-to-list, generate branch path based on node ID, and get the level of the node.

Build Setup

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

Setup

npm install @dadcici/tree-utils --save

Simple usage

import TreeUtils from ' @dadcici/tree-utils';

let list = [
  { id: 0, root: 'root' },
  { id: 1, name: 'name1', pid: 0 },
  { id: 2, name: 'name2', pid: 0 },
  { id: 3, name: 'name3', pid: 1 },
  { id: 4, name: 'name4', pid: 3 }
];

let tree = TreeUtils.list2Tree(list, 0);

License

Copyright (c) 2018 by www.dadcici.com

Current Tags

  • 0.0.16                                ...           latest (4 months ago)

2 Versions

  • 0.0.16                                ...           4 months ago
  • 0.0.15                                ...           4 months ago
Maintainers (1)
Downloads
Today 0
This Week 2
This Month 2
Last Day 0
Last Week 0
Last Month 8
Dependencies (1)
Dev Dependencies (11)

Copyright 2014 - 2018 © taobao.org |