{"id":20929207,"url":"https://github.com/luvies/format-tree","last_synced_at":"2026-04-11T00:46:24.259Z","repository":{"id":57240446,"uuid":"147122313","full_name":"luvies/format-tree","owner":"luvies","description":"Formats a tree structure into a string that can be printed","archived":false,"fork":false,"pushed_at":"2019-01-27T10:43:19.000Z","size":134,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-20T06:47:49.282Z","etag":null,"topics":["deno","denoland","format","javascript","node","node-js","nodejs","string","tree","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/format-tree","language":"TypeScript","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/luvies.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":"2018-09-02T21:13:42.000Z","updated_at":"2020-07-26T22:47:30.000Z","dependencies_parsed_at":"2022-08-30T00:11:46.122Z","dependency_job_id":null,"html_url":"https://github.com/luvies/format-tree","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luvies%2Fformat-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luvies%2Fformat-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luvies%2Fformat-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luvies%2Fformat-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luvies","download_url":"https://codeload.github.com/luvies/format-tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243324269,"owners_count":20273099,"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":["deno","denoland","format","javascript","node","node-js","nodejs","string","tree","typescript"],"created_at":"2024-11-18T21:18:00.219Z","updated_at":"2025-12-29T01:09:44.563Z","avatar_url":"https://github.com/luvies.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Format Tree\nThis library allows complete formatting of trees with guides and configurability that look similar to how npm and yarn dispay trees. The functions expect the predefined structure as defined in [mod.ts](lib/mod.ts), and the full documentation for that format is also described there. However, some examples are shown here (which are taken from the [test file](test/test.ts))\n\nThis library is compatible with [deno](https://github.com/denoland/deno) via the following direct import:\n\n`https://raw.githubusercontent.com/luvies/format-tree/{tag}/lib/mod.ts`\n\nor by using the slightly nicer:\n\n`https://denopkg.com/luvies/format-tree@{tag}/lib/mod.ts`\n\nIn both cases, the `{tag}` identifier is the release version you are targeting. I would recommend against using master directly (as, in general, the master branch is not guaranteed to be stable).\n\n## With first item\nSource:\n\n```ts\nformatTreeString(\n  {\n    text: 'first',\n    extra: 'extra',\n    children: [\n      {\n        text: 'second',\n        extra: 'another'\n      },\n      {\n        text: 'third',\n        children: [\n          {\n            text: 'fourth',\n            extra: 'yet'\n          },\n          {\n            text: 'fifth'\n          },\n          {\n            text: 'sixth',\n            extra: 'another',\n            children: [\n              {\n                text: 'seventh',\n                extra: 'one'\n              },\n              {\n                text: 'eighth',\n                extra: 'look',\n                children: [\n                  {\n                    text: 'ninth',\n                    extra: 'another'\n                  },\n                  {\n                    text: 'tenth',\n                    extra: 'one'\n                  }\n                ]\n              }\n            ]\n          }\n        ]\n      },\n      {\n        text: 'eleventh',\n        extra: 'yay'\n      }\n    ]\n  },\n  {\n    guideFormat: chalk.dim\n  }\n);\n```\n\nOutput:\n\n![node-stype output](docs/img/node-style.png)\n\n## Without first item\nSource:\n\n```ts\nformatTreeString(\n  [\n    {\n      text: 'first',\n      extra: 'extra'\n    },\n    {\n      text: 'second',\n      extra: 'another'\n    },\n    {\n      text: 'third',\n      children: [\n        {\n          text: 'fourth',\n          extra: 'yet'\n        },\n        {\n          text: 'fifth'\n        },\n        {\n          text: 'sixth',\n          extra: 'another',\n          children: [\n            {\n              text: 'seventh',\n              extra: 'one'\n            },\n            {\n              text: 'eighth',\n              extra: 'look',\n              children: [\n                {\n                  text: 'ninth',\n                  extra: 'another'\n                },\n                {\n                  text: 'tenth',\n                  extra: 'one'\n                }\n              ]\n            }\n          ]\n        }\n      ]\n    },\n    {\n      text: 'eleventh',\n      extra: 'yay'\n    }\n  ],\n  {\n    guideFormat: chalk.dim\n  }\n)\n```\n\nOutput:\n\n![list-style output](docs/img/list-style.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluvies%2Fformat-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluvies%2Fformat-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluvies%2Fformat-tree/lists"}