{"id":17269018,"url":"https://github.com/a1rpun/formatree","last_synced_at":"2025-04-14T08:06:08.274Z","repository":{"id":57240466,"uuid":"105311360","full_name":"A1rPun/formatree","owner":"A1rPun","description":"Format a tree like structure to a depth indented string","archived":false,"fork":false,"pushed_at":"2017-10-06T20:59:31.000Z","size":6,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T08:06:00.861Z","etag":null,"topics":[],"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/A1rPun.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":"2017-09-29T19:51:05.000Z","updated_at":"2021-02-06T01:41:00.000Z","dependencies_parsed_at":"2022-08-29T22:21:33.145Z","dependency_job_id":null,"html_url":"https://github.com/A1rPun/formatree","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/A1rPun%2Fformatree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/A1rPun%2Fformatree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/A1rPun%2Fformatree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/A1rPun%2Fformatree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/A1rPun","download_url":"https://codeload.github.com/A1rPun/formatree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248843819,"owners_count":21170488,"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-10-15T08:15:08.351Z","updated_at":"2025-04-14T08:06:08.201Z","avatar_url":"https://github.com/A1rPun.png","language":"JavaScript","readme":"# formatree\n\u003e Format a tree like structure to a depth indented string\n\n## Install\n```\n$ npm i -g formatree\n```\n\n## Usage\n```js\nconst formatree = require('formatree');\nconst tree = { foo: { bar: 0 }, baz: 1, qux: { quux: 2 } };\nformatree(tree);\n// .\n// ├── foo\n// │   └── bar\n// ├── baz\n// └── qux\n//     └── quux\n// \nformatree(tree, { limit: 1, spacing: 1, values: true });\n// .\n// │   \n// ├── foo\n// │   \n// ├── baz (1)\n// │   \n// └── qux\n// \nformatree(tree, { sibling: '|-- ', lastSibling: '`-- ', indent: '|   ' });\n// .\n// |-- foo\n// |   `-- bar\n// |-- baz\n// `-- qux\n//     `-- quux\n// \n```\n\n## API\n\n### formatree(input, [options])\n\n#### input\n\nType: `object`\n\nThe tree structure that needs to be formatted.\n\n#### options\n\nType: `Object`\n\n##### limit\n\nType: `number`  \nDefault: `0`\n\nLimit the tree at a specific branch depth, 0 is no limit.\n\n##### spacing\n\nType: `number`  \nDefault: `0`\n\nAdd some extra lines between the tree branches, 0 is no spacing.\n\n##### values\n\nType: `boolean`  \nDefault: `false`\n\nShow the values of the siblings in the tree\n\n##### header\n\nType: `string`  \nDefault: `.`\n\nThe first line of the tree\n\n##### footer\n\nType: `string`  \nDefault: empty\n\nThe last line of the tree\n\n##### parent\n\nType: `string`  \nDefault: ``\n\nAppend a string after a parent branch in the tree\n\n##### sibling\n\nType: `string`  \nDefault: `├── `\n\n##### lastSibling\n\nType: `string`  \nDefault: `└── `\n\n##### indent\n\nType: `string`  \nDefault: `│   `\n\n##### lastIndent\n\nType: `string`  \nDefault: `    `\n\n## Themes\n##### ASCII\n```\n{sibling: '|-- ',lastSibling: '`-- ',indent: '|   '}\n```\n##### Clean\n```\n{header: '',sibling: ' ',lastSibling: ' ',indent: '  ',lastIndent: '  ', footer: ''}\n```\n##### 101010\n```\n{header: '0',sibling: '101 ',lastSibling: '101 ',indent: '1010',lastIndent: '1010'}\n```\n##### Stripes\n```\n{sibling: '─ ',lastSibling: '─ ',indent: '──',lastIndent: '──'}\n```\n##### Arrows\n```\n{header: 'v',sibling: '\u003e ',lastSibling: '\u003e ',indent: '\u003e\u003e',lastIndent: '\u003e\u003e', footer: '^'}\n```\n\n## Related\n\n- [formatree-cli](https://github.com/A1rPun/formatree-cli) - CLI for this module\n\n## License\n\nMIT © [A1rPun](https://github.com/A1rPun)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa1rpun%2Fformatree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa1rpun%2Fformatree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa1rpun%2Fformatree/lists"}