{"id":19013332,"url":"https://github.com/z41z/easytree","last_synced_at":"2026-04-25T22:30:18.874Z","repository":{"id":205385428,"uuid":"714129186","full_name":"z41z/easytree","owner":"z41z","description":"Easy tree data processing.","archived":false,"fork":false,"pushed_at":"2023-11-04T02:26:33.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-12T06:50:31.681Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/z41z.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-04T01:59:54.000Z","updated_at":"2023-11-04T02:06:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"0564496b-8958-4f3c-9920-9e1c144ca6d8","html_url":"https://github.com/z41z/easytree","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"da623bcb74e6ff00ac3c0832af7da033d423dc2d"},"previous_names":["z41z/easytree"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z41z%2Feasytree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z41z%2Feasytree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z41z%2Feasytree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/z41z%2Feasytree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/z41z","download_url":"https://codeload.github.com/z41z/easytree/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240051342,"owners_count":19740334,"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":[],"created_at":"2024-11-08T19:23:25.059Z","updated_at":"2026-04-25T22:30:18.797Z","avatar_url":"https://github.com/z41z.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EasyTree\n\nEasy tree data processing.\n\n## Install\n\n``` node\n  npm i easydata-tree //or yarn add easydata-tree\n```\n\n## CDN\n\n``` js\n  \u003cscript src=\"https://unpkg.com/easydata-tree/dist/index.min.js\"\u003e\u003c/script\u003e\n  \u003cscript\u003e\n    new EasyTree({\n      id: 'id',\n      parentId: 'pid',\n      label: 'name',\n      children: 'child'\n    })\n  \u003c/script\u003e\n```\n\n### Usage\n\n``` js\nconst EasyTree = require(\"easydata-tree\")\nnew EasyTree({\n  id: 'id',\n  parentId: 'pid',\n  label: 'name',\n  children: 'child'\n})\nlet tree = [{\n  name: '-一级 1',\n  id: '一级 1',\n  z: 1,\n  child: [{\n    name: '-二级 1-1',\n    id: '二级 1-1',\n    z: 3,\n    child: [{\n      name: '-三级 1-1-1',\n      id: '三级 1-1-1',\n      z: 2\n    }]\n  }]\n}, {\n  name: '-一级 2',\n  id: '一级 2',\n  child: [{\n    name: '-二级 2-1',\n    id: '二级 2-1',\n    child: [{\n      name: '-三级 2-1-1',\n      id: '三级 2-1-1'\n    }]\n  }, {\n    name: '-二级 2-2',\n    id: '二级 2-2',\n    child: [{\n      name: '-三级 2-2-1',\n      id: '三级 2-2-1'\n    }]\n  }]\n}, {\n  name: '-一级 3',\n  id: '一级 3',\n  child: [{\n    name: '-二级 3-1',\n    id: '二级 3-1',\n    child: [{\n      name: '-三级 3-1-1',\n      id: '三级 3-1-1'\n    }]\n  }, {\n    name: '-二级 3-2',\n    id: '二级 3-2',\n    child: [{\n      name: '-三级 3-2-1',\n      id: '三级 3-2-1'\n    }]\n  }]\n}]\n```\n\n* toArray(parentId)\n  * {String|Number} parentId\n\n  ``` js\n    tree.toArray()\n  ```\n\n* toTree(parentId)\n  * {String|Number} parentId\n\n  ``` js\n    tree.toArray().toTree()\n  ```\n\n* findPath(id)\n  * {String|Number} id `required`\n\n  ``` js\n    tree.findPath('三级 3-1-1')\n  ```\n\n* findChildren(id)\n  * {String|Number} id `required`\n\n  ``` js\n    tree.findPath('一级 3')\n  ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz41z%2Feasytree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fz41z%2Feasytree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fz41z%2Feasytree/lists"}