{"id":13846777,"url":"https://github.com/jessitron/stringify-tree","last_synced_at":"2025-04-09T06:44:07.622Z","repository":{"id":57372690,"uuid":"162744704","full_name":"jessitron/stringify-tree","owner":"jessitron","description":"make a tree structure into a nice ascii printout","archived":false,"fork":false,"pushed_at":"2023-04-30T02:54:08.000Z","size":7364,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-18T17:59:30.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/jessitron.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":"2018-12-21T18:14:02.000Z","updated_at":"2020-07-30T09:48:32.000Z","dependencies_parsed_at":"2024-06-21T13:03:51.267Z","dependency_job_id":"cd218133-a50a-4bc2-9acf-5d1d34a32958","html_url":"https://github.com/jessitron/stringify-tree","commit_stats":{"total_commits":13,"total_committers":2,"mean_commits":6.5,"dds":0.3846153846153846,"last_synced_commit":"4a710bb032e188d60087aa72e82773940d9a588a"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jessitron%2Fstringify-tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jessitron%2Fstringify-tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jessitron%2Fstringify-tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jessitron%2Fstringify-tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jessitron","download_url":"https://codeload.github.com/jessitron/stringify-tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247994102,"owners_count":21030049,"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-08-04T18:00:47.097Z","updated_at":"2025-04-09T06:44:07.602Z","avatar_url":"https://github.com/jessitron.png","language":"TypeScript","readme":"# stringify-tree\n\nConvert a tree structure to an ASCII tree, in approximately the style of `npm ls`\n\nThis is in TypeScript, which helps since you pass it some functions.\n\n## install\n\n`npm install stringify-tree`\n\n## trivial example\n\n```typescript\nimport { stringifyTree } from \"stringify-tree\";\n\nconst tree = {\n        name: \"Grandmarti\", children: [\n            {\n                name: \"Cyndi\", children: [\n                    {\n                        name: \"Jess\", children: [\n                            { name: \"Evelyn\", children: [] },\n                            { name: \"Linda\", children: [] },\n                        ],\n                    },\n                ],\n            },\n            { name: \"Celia\", children: [] },\n        ],\n    };\n    console.log(stringifyTree(tree, t =\u003e t.name, t =\u003e t.children));\n```\n\n```\n┬ Grandmarti\n├─┬ Cyndi\n│ └─┬ Jess\n│   ├── Evelyn\n│   └── Linda\n└── Celia\n```\n\n## real-life example\n\n```typescript\nimport { stringifyTree } from \"stringify-tree\";\n\nfunction treeNodeName(tn: TreeNode) {\n    const endOffset = tn.$value ? \", \" + (tn.$offset + tn.$value.length) : \"\";\n    return `[${tn.$offset}${endOffset}] ${tn.$name}`;\n}\nfunction treeNodeChildren(tn: TreeNode): TreeNode[] {\n    return tn.$children || [];\n}\n\n// parser stuff from Atomist. trust me, it makes a TreeNode with fields like the above\n\nconst ast = await Java9FileParser.toAst(p.findFileSync(path));\nconsole.log(stringifyTree\u003cTreeNode\u003e(ast, treeNodeName, treeNodeChildren));\n```\n\n```\n\n```","funding_links":[],"categories":["JavaScript"],"sub_categories":["Require bundler"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjessitron%2Fstringify-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjessitron%2Fstringify-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjessitron%2Fstringify-tree/lists"}