0.7.1 • Published 5 years ago
@hexlet/trees v0.7.1
js-trees
Install
npm install @hexlet/treesUsage example
import Tree from '@hexlet/trees';
const tree = new Tree('/', 'root directory');
tree.getMeta(); // 'root directory'
const etcNode = tree.addChild('etc');
etcNode.getKey(); // 'etc'
tree.hasChild('etc'); // true
etcNode.getParent() === tree; // true
etcNode.hasChildren(); // false
tree.hasChildren(); // true
const libNode = etcNode.addChild('lib');
libNode === tree.getChild('lib'); // true
libNode === tree.getDeepChild(['etc', 'lib']); // true
etcNode.removeChild('lib'); // true
etcNode.hasChild('lib'); // falseFor more information, see the Full Documentation
This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet (in Russian).
