{"id":19529936,"url":"https://github.com/loopmode/treegen","last_synced_at":"2025-10-18T02:15:40.340Z","repository":{"id":140400233,"uuid":"39372182","full_name":"loopmode/treegen","owner":"loopmode","description":"Javascript random tree data generator","archived":false,"fork":false,"pushed_at":"2015-11-18T01:25:42.000Z","size":86,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-08T16:26:16.452Z","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/loopmode.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":"2015-07-20T08:31:17.000Z","updated_at":"2022-03-01T09:09:42.000Z","dependencies_parsed_at":"2023-06-26T01:21:53.397Z","dependency_job_id":null,"html_url":"https://github.com/loopmode/treegen","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/loopmode%2Ftreegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopmode%2Ftreegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopmode%2Ftreegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/loopmode%2Ftreegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/loopmode","download_url":"https://codeload.github.com/loopmode/treegen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240783109,"owners_count":19856776,"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-11T01:28:12.825Z","updated_at":"2025-10-18T02:15:35.308Z","avatar_url":"https://github.com/loopmode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# treegen\nGenerates random tree data using https://github.com/Marak/Faker.js\n\n## usage\n\nThe module exports a generator function with two required params: `depth` and `spread`, and both should be integer numbers.\nThe function will create a tree of objects that contain `name` (string), `data` (object) and `children` (array) properties.  \nYou can specify two additional, optional params in order to control the kind of data that is generated: `nameGen` and `dataGen`, both of type `Function`.\nIf you do not specify the generator functions, `faker.js` will be used to create some dummy data:\n\n\n\t\tvar treegen = require('treegen');\n\t\tvar tree = treegen(1, 3);\n\t\t// only one level of depth, but spread=3: result is an object with 3 children:\n\t\t/*\n\t\t{\n\t\t\t\"name\": \"Evert Carroll\",\n\t\t\t\"data\": {\n\t\t\t\t\"user\": \"Preston_Oberbrunner\",\n\t\t\t\t\"host\": \"leopold.name\",\n\t\t\t\t\"city\": \"West Roy bury\"\n\t\t\t},\n\t\t\t\"children\": [\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Jayme Wyman\",\n\t\t\t\t\t\"data\": {\n\t\t\t\t\t\t\"user\": \"Keaton_Braun96\",\n\t\t\t\t\t\t\"host\": \"izabella.com\",\n\t\t\t\t\t\t\"city\": \"East Marquis\"\n\t\t\t\t\t},\n\t\t\t\t\t\"children\": []\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Madisen Kulas\",\n\t\t\t\t\t\"data\": {\n\t\t\t\t\t\t\"user\": \"Bernard86\",\n\t\t\t\t\t\t\"host\": \"tony.org\",\n\t\t\t\t\t\t\"city\": \"Barry haven\"\n\t\t\t\t\t},\n\t\t\t\t\t\"children\": []\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"Joanie Maggio\",\n\t\t\t\t\t\"data\": {\n\t\t\t\t\t\t\"user\": \"Jamie22\",\n\t\t\t\t\t\t\"host\": \"jamar.name\",\n\t\t\t\t\t\t\"city\": \"North Marian\"\n\t\t\t\t\t},\n\t\t\t\t\t\"children\": []\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t\t*/\n\nWhen specifying generator functions, the name generator should return a string, while the data generator should return an object:\n\n\t\tvar treegen = require('treegen');\n\t\tfunction generateName() {\n\t\t\treturn 'myObjectName';\n\t\t}\n\t\tfunction generateData() {\n\t\t\treturn {\n\t\t\t\tfoo: 'bar'\n\t\t\t}\n\t\t}\n\t\tvar tree = treegen(1, 3, generateName, generateData);\n\t\t// same as before, but with different values\n\t\t/*\n\t\t{\n\t\t\t\"name\": \"myObjectName\",\n\t\t\t\"data\": {\n\t\t\t\t\"foo\": \"bar\"\n\t\t\t},\n\t\t\t\"children\": [\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"myObjectName\",\n\t\t\t\t\t\"data\": {\n\t\t\t\t\t\t\"foo\": \"bar\"\n\t\t\t\t\t},\n\t\t\t\t\t\"children\": []\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"myObjectName\",\n\t\t\t\t\t\"data\": {\n\t\t\t\t\t\t\"foo\": \"bar\"\n\t\t\t\t\t},\n\t\t\t\t\t\"children\": []\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"name\": \"myObjectName\",\n\t\t\t\t\t\"data\": {\n\t\t\t\t\t\t\"foo\": \"bar\"\n\t\t\t\t\t},\n\t\t\t\t\t\"children\": []\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t\t*/\n\nTODO: Figure out mathematical formula for predicting number of created objects, just for the readme. Should be some power or faculty between spread and depth, right?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floopmode%2Ftreegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Floopmode%2Ftreegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Floopmode%2Ftreegen/lists"}