https://github.com/zuck/node-tree
https://github.com/zuck/node-tree
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zuck/node-tree
- Owner: zuck
- Created: 2023-05-15T20:30:51.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-05-16T16:28:46.000Z (about 2 years ago)
- Last Synced: 2025-01-14T05:25:04.795Z (5 months ago)
- Language: JavaScript
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# node-tree
> An exercise about building an ordered tree from an unsorted list of nodes
## Introduction
This tool allows to generate a tree from a flat list of unsorted nodes like the
following:```json
[
{
"nodeId": "2",
"name": "Four",
"parentId": "1",
"previousSiblingId": "3"
},
{
"nodeId": "1",
"name": "One",
"parentId": null,
"previousSiblingId": null
},
{
"nodeId": "3",
"name": "Three",
"parentId": "1",
"previousSiblingId": null
}
]
```## Getting started
In order to execute this program, you need at least `Node.js >= 16.x`.
```bash
$ npm i$ npm start []
# e.g.
$ npm start test/inputs/t1.json
```## Testing
The test suite can be executed with the following command:
```bash
$ npm test
```## License
Copyright (c) Emanuele Bertoldi
MIT License