Comments (1)
We use Tree structure internally, we document its API at our web site, just because we use it ourselves for our site and other purposes: https://www.basicprimitives.com/reference/algorithms#Tree
Sources: https://github.com/BasicPrimitives/javascript/blob/master/src/algorithms/Tree.js
Tests: https://github.com/BasicPrimitives/javascript/blob/master/src/algorithms/Tree.test.js
See Tests for more details. It has method loopLevels
, it traverse tree nodes level by level, use levelid property of the callback function to break tree traversing at required level depth.
test('Function loopLevels should break loop on BREAK.', () => {
const tree = getTree(items);
const rootItems = [];
tree.loopLevels(this, function (nodeid, node, levelid) {
if (levelid > 0) {
return tree.BREAK;
}
rootItems.push(nodeid);
});
expect(rootItems).toEqual([0]);
});
from react-demo.
Related Issues (8)
- How to add an onclick event on Level annotation HOT 9
- How to export org diagram into pdf in react js HOT 2
- Can we display a tooltip on mouse hover of a node HOT 1
- Drag Drop is getting stuck HOT 1
- Display some information on hover of tree nodes
- yarn build gives Cannot find module 'util/' under javascript folder HOT 1
- Running yarn start from client directory gives Error: error:0308010C:digital envelope routines::unsupported HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-demo.