{"id":18351635,"url":"https://github.com/blackflux/object-treeify","last_synced_at":"2025-05-12T10:31:51.830Z","repository":{"id":34301611,"uuid":"176183272","full_name":"blackflux/object-treeify","owner":"blackflux","description":"Stringify Object as tree structure","archived":false,"fork":false,"pushed_at":"2025-01-29T19:09:06.000Z","size":3296,"stargazers_count":18,"open_issues_count":8,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-04T13:19:57.443Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blackflux.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-03-18T01:29:01.000Z","updated_at":"2025-02-14T04:06:06.000Z","dependencies_parsed_at":"2024-06-18T15:29:22.340Z","dependency_job_id":"9a5786dd-1946-43be-b84e-1183c61e071d","html_url":"https://github.com/blackflux/object-treeify","commit_stats":{"total_commits":725,"total_committers":7,"mean_commits":"103.57142857142857","dds":"0.19034482758620686","last_synced_commit":"404f75b029f82ad6617d31958ae7dafc7474337d"},"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackflux%2Fobject-treeify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackflux%2Fobject-treeify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackflux%2Fobject-treeify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blackflux%2Fobject-treeify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blackflux","download_url":"https://codeload.github.com/blackflux/object-treeify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253720003,"owners_count":21952938,"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-05T21:32:08.227Z","updated_at":"2025-05-12T10:31:51.548Z","avatar_url":"https://github.com/blackflux.png","language":"JavaScript","readme":"# object-treeify\n\n[![Build Status](https://circleci.com/gh/blackflux/object-treeify.png?style=shield)](https://circleci.com/gh/blackflux/object-treeify)\n[![NPM](https://img.shields.io/npm/v/object-treeify.svg)](https://www.npmjs.com/package/object-treeify)\n[![Downloads](https://img.shields.io/npm/dt/object-treeify.svg)](https://www.npmjs.com/package/object-treeify)\n\nStringify Object as tree structure\n\n```\n{\n    oranges: {\n        'mandarin': {                                          ├─ oranges\n            clementine: null,                                  │  └─ mandarin\n            tangerine: 'so cheap and juicy!'        -=\u003e        │     ├─ clementine\n        }                                                      │     └─ tangerine: so cheap and juicy!\n    },                                                         └─ apples\n    apples: {                                                     ├─ gala\n        'gala': null,                                             └─ pink lady\n        'pink lady': null\n    }\n}\n```\n\nProject was inspired by [treeify](https://github.com/notatestuser/treeify) and works almost identical. However\nthe algorithm is much shorter and faster, works without recursion and is very memory efficient. Furthermore\nthe output can be sorted using a custom comparator function.\n\n## Install\n\n    $ npm install --save object-treeify\n\n## Usage\n\n\u003c!-- eslint-disable import/no-unresolved,import/no-extraneous-dependencies --\u003e\n```js\nconst treeify = require('object-treeify');\n\ntreeify({\n  oranges: {\n    mandarin: {\n      clementine: null,\n      tangerine: 'so cheap and juicy!'\n    }\n  },\n  apples: {\n    gala: null,\n    'pink lady': null\n  }\n}, {/* options */});\n\n// =\u003e\n// ├─ oranges\n// │  └─ mandarin\n// │     ├─ clementine\n// │     └─ tangerine: so cheap and juicy!\n// └─ apples\n//    ├─ gala\n//    └─ pink lady\n```\n\n### Features\n\n- Allows for custom sorting\n- Very fast and memory efficient implementation\n- Input traversed exactly once\n- Dependency free and small in size\n- Tests to verify correctness\n- Handles circular references\n\n## Options\n\n### joined\n\nType: `boolean`\u003cbr\u003e\nDefault: `true`\n\nBy default a single string is returned. Can be set to `false` to instead return an array containing lines.\n\n#### spacerNoNeighbour\n\nType: `string`\u003cbr\u003e\nDefault: `   `\n\nPrefix for depth level when no further neighbour is present.\n\n#### spacerNeighbour\n\nType: `string`\u003cbr\u003e\nDefault: `│  `\n\nPrefix for depth level when a further neighbour is present.\n\n#### keyNoNeighbour\n\nType: `string`\u003cbr\u003e\nDefault: `└─ `\n\nPrefix for key when no further neighbour is present.\n\n#### keyNeighbour\n\nType: `string`\u003cbr\u003e\nDefault: `├─ `\n\nPrefix for key when a further neighbour is present.\n\n#### separator\n\nType: `string`\u003cbr\u003e\nDefault: `: `\n\nUsed to separate node key from node value.\n\n#### renderFn\n\nType: `function`\u003cbr\u003e\nDefault: `(node) =\u003e (['boolean', 'string', 'number'].includes(typeof node) ? node : undefined)`\n\nCan be used to overwrite the node rendering logic. Node is rendered if result is not equal `undefined`.\n\n#### sortFn\n\nType: `function`\u003cbr\u003e\nDefault: `null`\n\nFunction that defines the key sort order. Defaults to ordering of `Object.keys(...)`, which is typically insertion order.\n\n#### breakCircularWith\n\nType: `string` or `null`\u003cbr\u003e\nDefault: ` (circular ref.)`\n\nWhen `string`, circular references are broken with that string, at a minor performance cost.\n\n## Examples\n\nMore examples can be found in the tests.\n","funding_links":[],"categories":["Packages"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackflux%2Fobject-treeify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblackflux%2Fobject-treeify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackflux%2Fobject-treeify/lists"}