{"id":22355621,"url":"https://github.com/zbo14/web-tree","last_synced_at":"2025-10-09T19:44:35.286Z","repository":{"id":40936246,"uuid":"206134276","full_name":"zbo14/web-tree","owner":"zbo14","description":"Build trees of URLs.","archived":false,"fork":false,"pushed_at":"2022-12-30T18:33:03.000Z","size":302,"stargazers_count":1,"open_issues_count":12,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T13:12:57.733Z","etag":null,"topics":["add-on","firefox","tree","url"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zbo14.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-03T17:29:42.000Z","updated_at":"2020-10-07T08:03:02.000Z","dependencies_parsed_at":"2023-01-31T13:15:57.630Z","dependency_job_id":null,"html_url":"https://github.com/zbo14/web-tree","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zbo14/web-tree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbo14%2Fweb-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbo14%2Fweb-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbo14%2Fweb-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbo14%2Fweb-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zbo14","download_url":"https://codeload.github.com/zbo14/web-tree/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zbo14%2Fweb-tree/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259340671,"owners_count":22843036,"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":["add-on","firefox","tree","url"],"created_at":"2024-12-04T14:07:30.171Z","updated_at":"2025-10-09T19:44:30.251Z","avatar_url":"https://github.com/zbo14.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# web-tree\n\nThis repo has two components:\n- An npm library for constructing URL trees\n- A Firefox add-on that builds a URL tree as you browse and allows you to view the tree and filter by domain and/or path\n\n## Add-on\n\n### Install\n\nYou can install it [here](https://addons.mozilla.org/en-US/firefox/addon/web-tree)!\n\n#### For development\n\n1. Clone the repo and bundle the library for the browser with `npm run bundle`\n1. Open Firefox and enter `about:debugging#/runtime/this-firefox` into the search bar\n1. Click \"Load Temporary Add-On\"\n1. Select `add-on/manifest.json` from the project directory\n\n### Usage\n\nOpen devtools in Firefox and click on `web-tree`.\n\nYou should see `show` and `clear` buttons in the panel and a `filter` input.\n\nThe `show` button will display an expandable/collapsible subtree that falls under the `filter`ed domain/path (if any).\n\nThe `clear` button wipes the state of the tree clean.\n\n## Library\n\n### Install\n\n`npm i web-tree`\n\n### Usage\n\n#### Create a tree\n\n```js\n'use strict'\n\nconst Tree = require('web-tree')\n\nconst tree = new Tree()\n```\n\n#### Add URLs to tree\n\n```js\n// Set domains\ntree.set('https://foo.com')\ntree.set('https://bar.foo.com')\n\n// Set paths\ntree.set('https://baz.bar.foo.com?testing=123')\ntree.set('https://bar.foo.com/bam/fob')\ntree.set('https://bar.foo.com/bam/boo')\n```\n\n#### Get URL domain/path in tree\n\n```js\ntree.get('https://foo.com')             // returns domain\ntree.get('https://bar.foo.com/bam/fob') // returns path\ntree.get('https://foo.com/')            // returns undefined\n```\n\n#### Generate object representation of tree\n\n```js\ntree.toObject()\n\n// {\n//   com: {\n//     subdomains: {\n//       foo: {\n//         subdomains: {\n//           bar: {\n//             path: {\n//               subpaths: {\n//                 bam: {\n//                   subpaths: {\n//                     fob: {},\n//                     boo: {}\n//                   }\n//                 }\n//               }\n//             },\n//             subdomains: {\n//               baz: {\n//                 path: {\n//                   searchParams: {\n//                     testing: ['123']\n//                   }\n//                 }\n//               }\n//             }\n//           }\n//         }\n//       }\n//     }\n//   }\n// }\n```\n\n#### Generate string representation of tree\n\n```js\ntree.toString()\n\n// .com\n//   .foo\n//     .bar\n//       /bam\n//         /boo\n//         /fob\n//       .baz\n//         ?testing=123\n```\n\n#### Generate HTML representation of tree\n\n```js\ntree.toHTML()\n\n// \u003cbutton class=\"web-tree-btn\"\u003e.com\u003c/button\u003e\n// \u003cdiv class=\"web-tree-div\"\u003e\n//   \u003cbutton class=\"web-tree-btn\"\u003e.foo\u003c/button\u003e\n//   \u003cdiv class=\"web-tree-div\"\u003e\n//     \u003cbutton class=\"web-tree-btn\"\u003e.bar\u003c/button\u003e\n//     \u003cdiv class=\"Web-tree-div\"\u003e\n//       \u003cbutton class=\"web-tree-btn\"\u003e/bam\u003c/button\u003e\n//       \u003cdiv class=\"web-tree-div\"\u003e\n//         \u003cbutton class=\"web-tree-btn\"\u003e/boo\u003c/button\u003e\n//         \u003cdiv class=\"web-tree-div\"\u003e\n//         \u003c/div\u003e\n//         \u003cbutton class=\"web-tree-btn\"\u003e/fob\u003c/button\u003e\n//         \u003cdiv class=\"web-tree-div\"\u003e\n//         \u003c/div\u003e\n//       \u003c/div\u003e\n//       \u003cbutton class=\"web-tree-btn\"\u003e.baz\u003c/button\u003e\n//       \u003cdiv class=\"web-tree-div\"\u003e\n//         \u003cp\u003e?testing=123\u003c/p\u003e\n//       \u003c/div\u003e\n//     \u003c/div\u003e\n//   \u003c/div\u003e\n// \u003c/div\u003e\n```\n\n#### Delete URLs from tree\n\n```js\n// Delete domains\ntree.delete('https://baz.bar.foo.com')     // returns true\ntree.delete('https://bam.bar.foo.com')     // returns false\n\n// Delete paths\ntree.delete('https://bar.foo.com/bam/fob') // returns true\ntree.delete('https://foo.com/')            // returns false\n\n// Check string representation\ntree.toString()\n\n// .com\n//   .foo\n//     .bar\n//       /bam\n//         /boo\n```\n\n### Test\n\n`npm test`\n\n### Lint\n\n`npm run lint`\n\n### Documentation\n\n`npm run doc`\n\n## Contributing\n\nPlease do!\n\nIf you find a bug, want a feature added, or just have a question, feel free to [open an issue](https://github.com/zbo14/web-tree/issues/new). In addition, you're welcome to [create a pull request](https://github.com/zbo14/web-tree/compare/develop...) addressing an issue. You should push your changes to a feature branch and request merge to `develop`.\n\nMake sure linting and tests pass and coverage is 💯 before creating a pull request!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzbo14%2Fweb-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzbo14%2Fweb-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzbo14%2Fweb-tree/lists"}