Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dbkaplun/unsplay
Compute a tree from an array of objects with IDs and parent IDs
https://github.com/dbkaplun/unsplay
Last synced: 28 days ago
JSON representation
Compute a tree from an array of objects with IDs and parent IDs
- Host: GitHub
- URL: https://github.com/dbkaplun/unsplay
- Owner: dbkaplun
- License: mit
- Created: 2015-07-08T06:11:22.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-10-31T01:24:32.000Z (about 8 years ago)
- Last Synced: 2024-10-14T06:01:32.624Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unsplay [![Build Status](https://travis-ci.org/dbkaplun/unsplay.svg?branch=master)](https://travis-ci.org/dbkaplun/unsplay)
Compute a tree from an array of objects with IDs and parent IDs## Installation
```shell
$ npm install unsplay
```## Usage
```javascript
>> var unsplay = require('unsplay');
>> unsplay([{id: 0}, {id: 1, pid: 0}], 'id', 'pid');
[{
item: {id: 0},
children: [{
item: {id: 1, pid: 0},
children: []
}]
}]
```