{"_id":"array-treeify","_rev":"6-4885f8be6bd4ffc25949c3731b2d498c","name":"array-treeify","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.1":{"name":"array-treeify","version":"0.1.1","keywords":["ascii","tree","treeify"],"author":{"name":"tbeseda"},"license":"MIT","_id":"array-treeify@0.1.1","maintainers":[{"name":"tbeseda","email":"tbeseda@gmail.com"}],"homepage":"https://github.com/tbeseda/array-treeify#readme","bugs":{"url":"https://github.com/tbeseda/array-treeify/issues"},"dist":{"shasum":"d409f8998d02c7905c94248ed295a3d71214c33f","tarball":"https://registry.npmjs.org/array-treeify/-/array-treeify-0.1.1.tgz","fileCount":8,"integrity":"sha512-hmPcklzE6oYiBhcVZzKAYPV3SFWK51Ft+hrcVbeMmyv0dV8PBhPi2owMy42rPUDkgFaFFzzBWziDrMtQwknNTQ==","signatures":[{"sig":"MEUCIQCxNRmVjuGi5LmKH+5ANRHcC4FvMV8nRVeIfBZFLTVy/AIgFDGmAqvNRakJ5ofL5PKBUs9R7UbmZ8ld10Y0touHPEk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15319},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"29dcbd2bf85bd92bd25c9fb3860b22c589e39ffe","scripts":{"lint":"biome check --write .","test":"node --test","build":"rm -rf dist && tsc","pretest":"npm run build","posttest":"npm run lint","prepublishOnly":"npm run build"},"_npmUser":{"name":"tbeseda","email":"tbeseda@gmail.com"},"repository":{"url":"git+https://github.com/tbeseda/array-treeify.git","type":"git"},"_npmVersion":"11.0.0","description":"**Simple ASCII trees from arrays. For your terminal and console displays.**","directories":{},"_nodeVersion":"22.11.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.3","@types/node":"^22.13.14","@biomejs/biome":"1.9.4"},"_npmOperationalInternal":{"tmp":"tmp/array-treeify_0.1.1_1743225865981_0.0029392446486016244","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"array-treeify","version":"0.1.2","keywords":["ascii","tree","treeify"],"author":{"name":"tbeseda"},"license":"MIT","_id":"array-treeify@0.1.2","maintainers":[{"name":"tbeseda","email":"tbeseda@gmail.com"}],"homepage":"https://github.com/tbeseda/array-treeify#readme","bugs":{"url":"https://github.com/tbeseda/array-treeify/issues"},"dist":{"shasum":"d3baad527c62c5e975f39f37c3a054521ea3a4e8","tarball":"https://registry.npmjs.org/array-treeify/-/array-treeify-0.1.2.tgz","fileCount":4,"integrity":"sha512-Sc/G8QP8iV283PTaiPjdHVc2TRSl8H9Tysk5Si9TuTNm7Vi0CYIYfWSenIrY1hpCfGS6UMbTDDbkZ22ETOnyGQ==","signatures":[{"sig":"MEUCIQDHiGLrmgrksErV2XvsVOSPYw/KbeLvSqYaIfz/uc//dwIgXbes+3G37uanlnGyTkknqkSWgVn+AXo71yODY6CjD/4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9999},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"9cda3b328fd9021ff21315bcaedf4cd834fae71f","scripts":{"lint":"biome check --write .","test":"node --test","build":"rm -rf dist && tsc","pretest":"npm run build","posttest":"npm run lint","prepublishOnly":"npm run build"},"_npmUser":{"name":"tbeseda","email":"tbeseda@gmail.com"},"repository":{"url":"git+https://github.com/tbeseda/array-treeify.git","type":"git"},"_npmVersion":"11.0.0","description":"**Simple ASCII trees from arrays. For your terminal and console displays.**","directories":{},"_nodeVersion":"22.11.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.3","@types/node":"^22.13.14","@biomejs/biome":"1.9.4"},"_npmOperationalInternal":{"tmp":"tmp/array-treeify_0.1.2_1743286220323_0.7054715702986329","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"array-treeify","version":"0.1.3","keywords":["ascii","unicode","tree","treeify","diagram","cli","output","pretty","pretty print","pretty print tree"],"author":{"name":"tbeseda"},"license":"MIT","_id":"array-treeify@0.1.3","maintainers":[{"name":"tbeseda","email":"tbeseda@gmail.com"}],"homepage":"https://github.com/tbeseda/array-treeify#readme","bugs":{"url":"https://github.com/tbeseda/array-treeify/issues"},"dist":{"shasum":"8a8eeb3a44987f8b42c15a45a21d18db4ae0ae87","tarball":"https://registry.npmjs.org/array-treeify/-/array-treeify-0.1.3.tgz","fileCount":4,"integrity":"sha512-uUB7ngRUZe535QtK7VJeBIWcci58BFjT7O2of3Fkga/NPwr5vBeabMv83h1gMQVYVEyirXpp0kjqMGQftMTuiQ==","signatures":[{"sig":"MEYCIQCQceV3AKKr5nuRvhmVGmsch1YWnhPc+Ft8RDyZCplmSAIhAKXLttPhB2UCpY2Yj64tLo+dQrFH7PqxjsD+yoep9Ksw","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12712},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"0a7bfd9cff9167520efe774e8a0bdcac0c4ed802","scripts":{"lint":"biome check --write .","test":"tsx --test","build":"rm -rf dist && tsc","posttest":"npm run lint","prepublishOnly":"npm run build"},"_npmUser":{"name":"tbeseda","email":"tbeseda@gmail.com"},"repository":{"url":"git+https://github.com/tbeseda/array-treeify.git","type":"git"},"_npmVersion":"11.0.0","description":"Simple text tree diagrams from arrays.","directories":{},"_nodeVersion":"22.11.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.3","typescript":"^5.8.2","@types/node":"^22.13.14","@biomejs/biome":"1.9.4"},"_npmOperationalInternal":{"tmp":"tmp/array-treeify_0.1.3_1743394986018_0.9942543435435793","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"array-treeify","version":"0.1.4","keywords":["ascii","unicode","tree","treeify","diagram","cli","output","pretty","pretty print","pretty print tree"],"author":{"name":"tbeseda"},"license":"MIT","_id":"array-treeify@0.1.4","maintainers":[{"name":"tbeseda","email":"tbeseda@gmail.com"}],"homepage":"https://github.com/tbeseda/array-treeify#readme","bugs":{"url":"https://github.com/tbeseda/array-treeify/issues"},"dist":{"shasum":"6238af207ac887dedf94a2ca918987edcda20086","tarball":"https://registry.npmjs.org/array-treeify/-/array-treeify-0.1.4.tgz","fileCount":4,"integrity":"sha512-m7mf8Nq0oSa4ka3jVtrZKmad/zCkoN9s4FnYykSOd820jT0SUNF/rZ/A3Fy336O2Kd/7saS8XSERy/uTrp1FJA==","signatures":[{"sig":"MEYCIQDNzp7xoxN1XfyGd+qRVPXDziEKG+I886R2bzAoO9bk0AIhAOLzclJ+DpQeQ+gVZRQdKElmLLfs/QZ3eHms/Pkym1hA","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12723},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"8e4221c8d0660a1569cc98e7d2a619363571826f","scripts":{"lint":"biome check --write .","test":"tsx --test","build":"rm -rf dist && tsc","posttest":"npm run lint","prepublishOnly":"npm run build"},"_npmUser":{"name":"tbeseda","email":"tbeseda@gmail.com"},"repository":{"url":"git+https://github.com/tbeseda/array-treeify.git","type":"git"},"_npmVersion":"10.9.2","description":"Simple text tree diagrams from arrays.","directories":{},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.4","typescript":"^5.8.3","@types/node":"^22.15.15","@biomejs/biome":"1.9.4"},"_npmOperationalInternal":{"tmp":"tmp/array-treeify_0.1.4_1746651903986_0.6657384603790679","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"array-treeify","version":"0.1.5","keywords":["ascii","unicode","tree","treeify","diagram","cli","output","pretty","pretty print","pretty print tree"],"author":{"name":"tbeseda"},"license":"MIT","_id":"array-treeify@0.1.5","maintainers":[{"name":"tbeseda","email":"tbeseda@gmail.com"}],"homepage":"https://github.com/tbeseda/array-treeify#readme","bugs":{"url":"https://github.com/tbeseda/array-treeify/issues"},"dist":{"shasum":"3be11f428aa6e4f88d1ae71ce9242f7edf818cc3","tarball":"https://registry.npmjs.org/array-treeify/-/array-treeify-0.1.5.tgz","fileCount":4,"integrity":"sha512-Ag85dlQyM0wahhm62ZvsLDLU0TcGNXjonRWpEUvlmmaFBuJNuzoc19Gi51uMs9HXoT2zwSewk6JzxUUw8b412g==","signatures":[{"sig":"MEYCIQD3tpwnibB/DD9vSFHU4yRWuzDxxapap4qJMu7DezGrbQIhAM6p6gJvdMKh79k046qDD5yVo/2HPiCutWefREk1h6dC","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12949},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","gitHead":"098b92e2599768014009cdc82430892b2263c4ce","scripts":{"lint":"biome check --write .","test":"tsx --test","build":"rm -rf dist && tsc","posttest":"npm run lint","prepublishOnly":"npm run build"},"_npmUser":{"name":"tbeseda","email":"tbeseda@gmail.com"},"repository":{"url":"git+https://github.com/tbeseda/array-treeify.git","type":"git"},"_npmVersion":"10.9.2","description":"Simple text tree diagrams from arrays.","directories":{},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.4","typescript":"^5.8.3","@types/node":"^22.15.15","@biomejs/biome":"1.9.4"},"_npmOperationalInternal":{"tmp":"tmp/array-treeify_0.1.5_1746734367006_0.2426337315170486","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"array-treeify","version":"0.2.0","description":"Simple text tree diagrams from arrays.","license":"MIT","author":{"name":"tbeseda"},"repository":{"type":"git","url":"git+https://github.com/tbeseda/array-treeify.git"},"type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"sideEffects":false,"engines":{"node":">=22"},"scripts":{"lint":"biome ci .","lint:write":"biome check --write .","check":"npm run typecheck && npm run lint","typecheck":"tsc -p tsconfig.json","build":"rm -rf dist && tsc -p tsconfig.build.json","test":"node --test","prepublishOnly":"npm run build"},"devDependencies":{"@biomejs/biome":"^2.5.8","@types/node":"^22","typescript":"^7.0.2"},"keywords":["ascii","unicode","tree","treeify","diagram","cli","output","pretty","pretty print","pretty print tree"],"gitHead":"2eaf41d61e82ab11bcc25e3a489c2452135d2c72","_id":"array-treeify@0.2.0","bugs":{"url":"https://github.com/tbeseda/array-treeify/issues"},"homepage":"https://github.com/tbeseda/array-treeify#readme","_nodeVersion":"24.18.0","_npmVersion":"12.0.1","dist":{"integrity":"sha512-d+MaMMwIZF6XKSMtfdJNgqpj4+mSYUSc4dibyycBEEbcvnXT5gIyFu2etZiQEW3zjJU8Q7i1KUF9/5RYX9AoOQ==","shasum":"b21f7cfa976399cd6de14abad813a52bb0a2560b","tarball":"https://registry.npmjs.org/array-treeify/-/array-treeify-0.2.0.tgz","fileCount":5,"unpackedSize":16657,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFbHxTE8uKaF1OVZ1Y79aO2VoVQfPpDB7VREVANZyxZaAiEAjyJQuLflCqhK/pLEk0hklACy71bKME8PFH/oa7DgSpI="}]},"_npmUser":{"name":"tbeseda","email":"tbeseda@gmail.com"},"directories":{},"maintainers":[{"name":"tbeseda","email":"tbeseda@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/array-treeify_0.2.0_1786672541204_0.6343772384949937"},"_hasShrinkwrap":false}},"time":{"created":"2025-03-29T05:24:25.980Z","modified":"2026-08-14T01:55:41.504Z","0.1.1":"2025-03-29T05:24:26.180Z","0.1.2":"2025-03-29T22:10:20.503Z","0.1.3":"2025-03-31T04:23:06.184Z","0.1.4":"2025-05-07T21:05:04.173Z","0.1.5":"2025-05-08T19:59:27.162Z","0.2.0":"2026-08-14T01:55:41.346Z"},"bugs":{"url":"https://github.com/tbeseda/array-treeify/issues"},"author":{"name":"tbeseda"},"license":"MIT","homepage":"https://github.com/tbeseda/array-treeify#readme","keywords":["ascii","unicode","tree","treeify","diagram","cli","output","pretty","pretty print","pretty print tree"],"repository":{"type":"git","url":"git+https://github.com/tbeseda/array-treeify.git"},"description":"Simple text tree diagrams from arrays.","maintainers":[{"name":"tbeseda","email":"tbeseda@gmail.com"}],"readme":"# 🪾 `array-treeify`\n\n**Simple text trees from arrays using Unicode box-drawing characters. For your terminal and console displays.**\n\n[![typescript](https://img.shields.io/badge/TypeScript-007ACC?style=flat&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)\n[![npm](https://img.shields.io/npm/v/array-treeify.svg)](https://www.npmjs.com/package/array-treeify)\n[![ci](https://github.com/tbeseda/array-treeify/actions/workflows/ci.yml/badge.svg)](https://github.com/tbeseda/array-treeify/actions/workflows/ci.yml)\n[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/tbeseda/array-treeify/blob/main/LICENSE)\n\n## Overview\n\n`array-treeify` transforms nested arrays into text trees with proper branching characters. Perfect for CLIs, debug outputs, or anywhere you need to visualize hierarchical data.\n\n```typescript\ntreeify([\n  'Lumon Industries',\n  [\n    'Board of Directors',\n    ['Natalie (Representative)'],\n    'Departments',\n    [\n      'Macrodata Refinement (Cobel)',\n      ['Milchick', 'Mark S.', ['Dylan G.', 'Irving B.', 'Helly R.']],\n    ],\n    'Other Departments',\n    [\n      'Optics & Design',\n      'Wellness Center',\n      'Mammalians Nurturable',\n      'Choreography and Merriment',\n    ],\n  ],\n])\n```\n\n\n```\nLumon Industries\n├─ Board of Directors\n│  └─ Natalie (Representative)\n├─ Departments\n│  └─ Macrodata Refinement (Cobel)\n│     ├─ Milchick\n│     └─ Mark S.\n│        ├─ Dylan G.\n│        ├─ Irving B.\n│        └─ Helly R.\n└─ Other Departments\n   ├─ Optics & Design\n   ├─ Wellness Center\n   ├─ Mammalians Nurturable\n   └─ Choreography and Merriment\n```\n\n## Installation\n\n```bash\nnpm install array-treeify\n```\n\nZero dependencies, ESM only. Requires Node.js 22 or newer (or any runtime that supports ES modules).\n\n## Usage\n\n```typescript\nfunction treeify(input: TreeInput, options?: {\n  chars?: TreeChars,  // Custom characters for the tree\n  plain?: boolean     // Use plain whitespace instead of Unicode box-drawing characters\n}): string\n```\n\n`array-treeify` accepts a simple, intuitive array structure that's easy to build and manipulate:\n\n```typescript\nimport {treeify} from 'array-treeify'\n\n// Basic example\nconst eagan = [\n  'Kier Eagan', \n  [\n    '...',\n    [\n      '...',\n      'Jame Eagan',\n      ['Helena Eagan']\n    ],\n    'Ambrose Eagan',\n  ],\n]\nconsole.log(treeify(eagan))\n/*\nKier Eagan\n├─ ...\n│  ├─ ...\n│  └─ Jame Eagan\n│     └─ Helena Eagan\n└─ Ambrose Eagan\n*/\n\n// Using custom characters\nconst resultCustomChars = treeify(\n  eagan, \n  { chars: { branch: '├• ', lastBranch: '└• ', pipe: '│  ', space: '   ' },\n})\n/*\nKier Eagan\n├• ...\n│  ├• ...\n│  └• Jame Eagan\n│     └• Helena Eagan\n└• Ambrose Eagan\n*/\n\n// Using plain whitespace characters\nconsole.log(treeify(eagan, { plain: true }))\n/*\nKier Eagan\n   ...\n      ...\n      Jame Eagan\n         Helena Eagan\n   Ambrose Eagan\n*/\n\n// Nested example\nconst orgChart = [\n  'Lumon Industries',\n  [\n    'Board of Directors',\n    ['Natalie (Representative)'],\n    'Department Heads',\n    [\n      'Cobel (MDR)',\n      ['Milchick', 'Mark S.', ['Dylan G.', 'Irving B.', 'Helly R.']]\n    ]\n  ]\n]\nconsole.log(treeify(orgChart))\n/*\nLumon Industries\n├─ Board of Directors\n│  └─ Natalie (Representative)\n└─ Department Heads\n   └─ Cobel (MDR)\n      ├─ Milchick\n      └─ Mark S.\n         ├─ Dylan G.\n         ├─ Irving B.\n         └─ Helly R.\n*/\n```\n\n## Input Format\n\nThe `treeify` function accepts arrays with the following structure:\n\n1. First element must be a string (the root node)\n2. Subsequent elements can be labels (nodes at same level) or arrays (children of previous node)\n3. Arrays can be nested to any depth\n\n```typescript\n['root', 'sibling', ['child1', 'child2']]             // Root with 2 children\n['root', ['child'], 'sibling', ['nephew', 'niece']]   // 2 root nodes with children\n['root', ['child', ['grandchild']]]                   // Grandchildren\n```\n\n### Labels\n\nAny value that isn't an array is a label. Non-strings are stringified, so numbers and booleans work anywhere a string does — including as parent nodes:\n\n```typescript\nconsole.log(treeify(['deploys', [2025, ['spring', 'summer'], 2026, ['q1']]]))\n/*\ndeploys\n├─ 2025\n│  ├─ spring\n│  └─ summer\n└─ 2026\n   └─ q1\n*/\n```\n\n### Errors\n\n`treeify` throws a `TypeError` when it can't render what it was given:\n\n- the input is not an array — `array-treeify: expected an array, received null`\n- the first element is not a string — `array-treeify: expected the first element to be a string, received number (1)`\n\nAn empty array returns an empty string, so `treeify([])` is a safe way to say \"nothing to render\".\n\n### Types\n\nThe exported `TreeInput` type (`Array<string | TreeInput>`) is intentionally permissive so trees can be assembled programmatically — build an array up with `push` and hand it over. A tuple type such as `[string, ...(string | TreeInput)[]]` *could* require a string first element at compile time, but it would rule out that dynamic construction, so the rule is enforced at runtime instead.\n\n## Options\n\n- `chars`: Custom characters for the tree. Defaults to Unicode box-drawing characters.\n- `plain`: When true, uses plain whitespace characters instead of Unicode box-drawing characters.\n\n## Development\n\nSource lives in `src/` and runs directly on Node.js — the tests are `.ts` files executed by Node's built-in test runner and type stripping, so there's no build step or loader involved in testing. Node.js 22.18 or newer is required to work on the library.\n\n```bash\nnpm test          # node --test\nnpm run typecheck # tsc, covers src/ including tests\nnpm run lint      # biome ci, no writes\nnpm run lint:write\nnpm run check     # typecheck + lint, what CI runs\nnpm run build     # emit dist/ with declarations\n```\n\n## License\n\nMIT © tbeseda\n","readmeFilename":"README.md"}