{"id":17006287,"url":"https://github.com/rookie-luochao/build-tree-datasource","last_synced_at":"2025-04-12T06:32:44.430Z","repository":{"id":35009660,"uuid":"195971984","full_name":"rookie-luochao/build-tree-datasource","owner":"rookie-luochao","description":"build a dataSource for common ui trees","archived":false,"fork":false,"pushed_at":"2024-09-23T23:00:50.000Z","size":262,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-10-31T10:51:32.601Z","etag":null,"topics":["tree","tree-data"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/build-tree-datasource","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rookie-luochao.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-07-09T09:00:09.000Z","updated_at":"2024-01-08T06:39:09.000Z","dependencies_parsed_at":"2023-02-10T08:16:04.695Z","dependency_job_id":"13295468-cb8a-49fd-8e67-b7eaea8459b1","html_url":"https://github.com/rookie-luochao/build-tree-datasource","commit_stats":{"total_commits":35,"total_committers":3,"mean_commits":"11.666666666666666","dds":"0.34285714285714286","last_synced_commit":"c3031ea1eef1d35c815c6e2d943e09cae463d603"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rookie-luochao%2Fbuild-tree-datasource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rookie-luochao%2Fbuild-tree-datasource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rookie-luochao%2Fbuild-tree-datasource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rookie-luochao%2Fbuild-tree-datasource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rookie-luochao","download_url":"https://codeload.github.com/rookie-luochao/build-tree-datasource/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223502361,"owners_count":17155938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["tree","tree-data"],"created_at":"2024-10-14T05:05:27.895Z","updated_at":"2024-11-07T11:05:10.800Z","avatar_url":"https://github.com/rookie-luochao.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"```\nimport buildTree from \"build-tree-datasource\";\n\nconst source = [\n  {\n    id: 1,\n    parentId: undefined,\n    groupName: {\n      name: '经理1',\n      count: 10\n    },\n  },\n  {\n    id: 2,\n    parentId: null,\n    groupName: {\n      name: '经理2',\n      count: 1\n    },\n  },\n  {\n    id: 3,\n    parentId: 0,\n    groupName: {\n      name: '经理3',\n      count: 2\n    },\n  },\n  {\n    id: 4,\n    parentId: 1,\n    groupName: {\n      name: '主管1',\n      count: 4\n    },\n  },\n  {\n    id: 5,\n    parentId: 1,\n    groupName: {\n      name: '主管2',\n      count: 6\n    },\n  },\n  {\n    id: 6,\n    parentId: 4,\n    groupName: {\n      name: '小组1',\n      count: 4\n    },\n  },\n  {\n    id: 7,\n    parentId: 5,\n    groupName: {\n      name: '小组2',\n      count: 4\n    },\n  },\n  {\n    id: 8,\n    parentId: 2,\n    groupName: {\n      name: '主管3',\n      count: 0\n    },\n  },\n  {\n    id: 9,\n    parentId: 3,\n    groupName: {\n      name: '主管4',\n      count: 0\n    },\n  },\n];\n\n// first param is init data(array)\n// second param is unique element ID, default is id\n// third param is link ID between nodes, default is parentId\n\nconsole.log(buildTree(source))\nconsole.log(buildTree(source, \"id\", \"parentId\"))\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frookie-luochao%2Fbuild-tree-datasource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frookie-luochao%2Fbuild-tree-datasource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frookie-luochao%2Fbuild-tree-datasource/lists"}