Skip to content

Instantly share code, notes, and snippets.

View nichenqin's full-sized avatar
🧗
Climbing

nichenqin nichenqin

🧗
Climbing
  • 上海
  • 09:18 (UTC -12:00)
View GitHub Profile
@nichenqin
nichenqin / build-tree.js
Created October 17, 2017 15:17
unflatten array into tree
const arr = [
{ id: 1, parentid: 0 },
{ id: 4, parentid: 2 },
{ id: 3, parentid: 1 },
{ id: 5, parentid: 0 },
{ id: 6, parentid: 0 },
{ id: 2, parentid: 1 },
{ id: 7, parentid: 4 },
{ id: 8, parentid: 1 },
{ id: 9, parentid: 7 },
@nichenqin
nichenqin / handleTree.js
Created October 16, 2017 10:08
递归获取树形最后一组数据
const tree = [
{
name: '1',
children: [
{
name: '1-1',
},
]
},
{