{"id":20806298,"url":"https://github.com/nodesource/deep-hierarchy","last_synced_at":"2025-05-11T17:31:42.880Z","repository":{"id":147579445,"uuid":"43285810","full_name":"nodesource/deep-hierarchy","owner":"nodesource","description":"A fork of d3's base hierarchy layout which includes the values of inner nodes in its final sums","archived":true,"fork":false,"pushed_at":"2016-03-16T21:22:29.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-12T15:03:36.254Z","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/nodesource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2015-09-28T07:16:28.000Z","updated_at":"2025-01-30T21:18:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"2d0e71c0-8a75-44f2-a321-9a9241513780","html_url":"https://github.com/nodesource/deep-hierarchy","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fdeep-hierarchy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fdeep-hierarchy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fdeep-hierarchy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fdeep-hierarchy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodesource","download_url":"https://codeload.github.com/nodesource/deep-hierarchy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253604833,"owners_count":21934904,"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-17T19:19:09.286Z","updated_at":"2025-05-11T17:31:42.642Z","avatar_url":"https://github.com/nodesource.png","language":"JavaScript","readme":"# deep-hierarchy\n\nA fork of [d3](http://github.com/mbostock/d3)'s [hierarchy base layout](https://github.com/d3/d3-hierarchy/blob/master/src/hierarchy.js) which includes the values of inner nodes in its final sums.\n\n## Usage\n\n### `hierarchy = Hierarchy()`\n\nCreates a new hierarchy layout instance.\n\n### `hierarchy.children([children])`\n\nIf children is specified, sets the specified children accessor function. If children is not specified, returns the current children accessor function, which by default assumes that the input data is an object with a children array:\n\n``` javascript\nfunction children(d) {\n  return d.children\n}\n```\n\n### `hierarchy.value([value])`\n\nIf value is specified, sets the value accessor to the specified function. If value is not specified, returns the current value accessor, which assumes that the input data is an object with a numeric value attribute:\n\n``` javascript\nfunction value(d) {\n  return d.value\n}\n```\n\n***Note:*** *multiple calls to `hierarchy.nodes` on the same root node will result in re-accummulating each node's values. It's wise to have your `value` accessor set to something other than the default to avoid unexpected results.*\n\n### `hierarchy.sort([comparator])`\n\nIf comparator is specified, sets the sort order of sibling nodes for the layout using the specified comparator function. If comparator is not specified, returns the current group sort order, which defaults to descending order by the associated input data's numeric value attribute:\n\n``` javascript\nfunction comparator(a, b) {\n  return b.value - a.value\n}\n```\n\n### `hierarchy.nodes(root)`\n\nRuns the hierarchy layout, returning the array of nodes associated with the specified root node. In the process of doing so, the following properties will be added to each node in your tree:\n\n* `parent`: the parent node, or null for the root.\n* `children`: the array of child nodes, or null for leaf nodes.\n* `value`: the node value, as returned by the value accessor.\n* `depth`: the depth of the node, starting at 0 for the root.\n\n## Authors and Contributors\n\n\u003ctable\u003e\u003ctbody\u003e\n\u003ctr\u003e\u003cth align=\"left\"\u003eHugh Kennedy\u003c/th\u003e\u003ctd\u003e\u003ca href=\"https://github.com/hughsk\"\u003eGitHub/hughsk\u003c/a\u003e\u003c/td\u003e\u003ctd\u003e\u003ca href=\"http://twitter.com/hughskennedy\"\u003eTwitter/@hughskennedy\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\n\u003c/tbody\u003e\u003c/table\u003e\n\nContributions are welcomed from anyone wanting to improve this project!\n\n## License \u0026 Copyright\n\n**deep-hierarchy** is Copyright (c) 2015 NodeSource and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included [LICENSE.md](./LICENSE.md) file for more details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesource%2Fdeep-hierarchy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodesource%2Fdeep-hierarchy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesource%2Fdeep-hierarchy/lists"}