
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Break the complex tree structures in your db and get the data in simple form to use it in your app
var breaktree = require('breaktree');
breaktree.getHierarchy(test,attribute,attributes)
The structure for the object must be in this form
test : Will be an Empty Array in which you will get the hierarchy
Eg: []
attribute: Attribute for which you want the hierarchy
Eg:{id: 5,name: 'child Element',parent: 4 }
attributes: List of Attributes
Eg: [{id: 5,name: 'Child 1',parent: 1 },{id: 1,name: 'Top parent',parent: null },{id: 2,name: 'Child 1',parent: 1 },{id: 3,name: 'Child 3',parent: 2 },{id: 4,name: 'Child 4',parent: 3 },{id: 5,name: 'child Element',parent: 4 },{id: 6,name: 'Child 6',parent: 5 } ]
The result you will get in the test array as
[{"id":4,"name":"Child 4"},{"id":3,"name":"Child 3"},{"id":2,"name":"Child 1"}]
The test array will contain the data from low to high parent hierarchy.If you want it the opposite way you can just reverse the array
var breaktree = require('breaktree');
breaktree.getRoot(attributes,attribute,root)
The structure for the object must be in this form
attributes: List of Attributes
Eg: [{id: 5,name: 'Child 1',parent: 1 },{id: 1,name: 'Top parent',parent: null },{id: 2,name: 'Child 1',parent: 1 },{id: 3,name: 'Child 3',parent: 2 },{id: 4,name: 'Child 4',parent: 3 },{id: 5,name: 'child Element',parent: 4 },{id: 6,name: 'Child 6',parent: 5 } ]
attribute: Attribute for which you want the root
Eg:{id: 5,name: 'child Element',parent: 4 }
root : Will be an Empty Array in which you will get the root element
Eg: []
The result you will get in the root array as
[{id: 1,name: 'Top parent',parent: null }]
FAQs
Package to identify the root parent and shortest child in database system
We found that breaktree demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.