Convert large amounts of data array to tree fastly
JavaScript
Switch branches/tags
Nothing to show
Latest commit 38b1bf4 Nov 21, 2017 @internet5 internet5 Update .travis.yml
Permalink
Failed to load latest commit information.
test Update test.js Nov 21, 2017
.travis.yml Update .travis.yml Nov 21, 2017
LICENSE Initial commit Nov 17, 2017
README.md Update README.md Nov 21, 2017
index.js Update index.js Nov 21, 2017
package.json Update package.json Nov 21, 2017

README.md

smart-array-to-tree

Build Status
Convert large amounts of data array to nested data structure fastly!
Use the test data that array length 46086, just take about 0.1 second.

快速地转换数据量比较大的数组为树结构,转换数组长度为46086的组数时,只花了大约0.1秒的时间,而其他转换工具对于这个数据量要么就是转换不正确,要么就是直接挂掉

Installation

  npm i smart-arraytotree --save

Example

import smartArrayToTree from 'smart-arraytotree';
 let areas=[];//test data length 46086
 console.log("start time:"+moment().format("hh:mm:SSSS"))
 let tree=smartArrayToTree({array:areas,id:"id",pid:"pid",children:"children",firstPid:null})
 console.log("end time:"+moment().format("hh:mm:SSSS"))
 /*console*/
 //start time:05:54:4590
 //end time:05:54:6170