{"_id":"text-treeview","_rev":"7-cd5621a753a84f7edd8e6ff6ba6655f3","name":"text-treeview","dist-tags":{"latest":"1.0.2"},"versions":{"0.9.0":{"name":"text-treeview","version":"0.9.0","description":"Create a tree hierarcy for console output","main":"index.js","scripts":{"test":"istanbul cover node_modules/jasmine/bin/jasmine.js -verbose JASMINE_CONFIG_PATH=./jasmine.json","report-coverage":"codecov"},"repository":{"type":"git","url":"git+https://github.com/dlid/text-treeview.git"},"keywords":["node","node.js","text","tree","treeview"],"author":{"name":"David Lidström"},"license":"MIT","bugs":{"url":"https://github.com/dlid/text-treeview/issues"},"homepage":"https://github.com/dlid/text-treeview#readme","devDependencies":{"chalk":"^2.3.2","codecov":"^3.0.0","istanbul":"^0.4.5","jasmine":"^3.1.0","jasmine-node":"^1.14.5","jasmine-reporters":"^2.3.0"},"gitHead":"da66a65c2b1e9b46ca30ae61d3b155b7409129f9","_id":"text-treeview@0.9.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"dlid","email":"npm@dlid.se"},"dist":{"integrity":"sha512-iZeDxnWbt6iJeexkr0x1omPTArAv+J9uD4pdi2h8OSicxGR7CNh3wByX0RsZBp7gDTLm1vUE+uq4wrkLKiLG+A==","shasum":"901fdf48fe45ac4959af8042f78f7d9573a54d25","tarball":"https://registry.npmjs.org/text-treeview/-/text-treeview-0.9.0.tgz","fileCount":5,"unpackedSize":8434,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCbLeUVYrRQdTbQBAVhdhsEiLaxay/7Vp8NEzJC10+f1QIgSSCFvJp9HMDVsVgki7Qa/KQ9rj3/S9Vh2Dqz3EDLOd4="}]},"maintainers":[{"name":"dlid","email":"npm@dlid.se"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/text-treeview_0.9.0_1521396585127_0.9604045299305202"},"_hasShrinkwrap":false},"1.0.0":{"name":"text-treeview","version":"1.0.0","description":"Create a tree hierarcy for console output","main":"index.js","scripts":{"test":"istanbul cover node_modules/jasmine/bin/jasmine.js -verbose JASMINE_CONFIG_PATH=./jasmine.json","report-coverage":"codecov"},"repository":{"type":"git","url":"git+https://github.com/dlid/text-treeview.git"},"keywords":["node","node.js","text","tree","treeview"],"author":{"name":"David Lidström"},"license":"MIT","bugs":{"url":"https://github.com/dlid/text-treeview/issues"},"homepage":"https://github.com/dlid/text-treeview#readme","devDependencies":{"chalk":"^2.3.2","codecov":"^3.0.0","istanbul":"^0.4.5","jasmine":"^3.1.0","jasmine-node":"^1.14.5","jasmine-reporters":"^2.3.0"},"gitHead":"2e8f4da0da90cec30365ec0c6523d92e9f435953","_id":"text-treeview@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"dlid","email":"npm@dlid.se"},"dist":{"integrity":"sha512-bIvgLCHb4E8PtiKk06RxC2x7aB0TbtCHO7lHK3SXy1rBe64UlweRNIKd7FkcNK/CAwQ+ksG52a2I5EvSZkAunw==","shasum":"449b7a4a59439ba2ea66e7e1d5d1e4ab5b61cdfc","tarball":"https://registry.npmjs.org/text-treeview/-/text-treeview-1.0.0.tgz","fileCount":5,"unpackedSize":11013,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDf/DLeCZV4KLKtaaTkGfepVmxxasKNtRoVAIV5KJNAeAIgL56vZCHnDvJOVzywlihJTSfrJQ0n4qpDNdX+26kk7hE="}]},"maintainers":[{"name":"dlid","email":"npm@dlid.se"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/text-treeview_1.0.0_1521398445746_0.6070439685654361"},"_hasShrinkwrap":false},"1.0.1":{"name":"text-treeview","version":"1.0.1","description":"Create a tree hierarcy for console output","main":"index.js","scripts":{"test":"istanbul cover node_modules/jasmine/bin/jasmine.js -verbose JASMINE_CONFIG_PATH=./jasmine.json","report-coverage":"codecov"},"repository":{"type":"git","url":"git+https://github.com/dlid/text-treeview.git"},"keywords":["node","node.js","text","tree","treeview"],"author":{"name":"David Lidström"},"license":"MIT","bugs":{"url":"https://github.com/dlid/text-treeview/issues"},"homepage":"https://github.com/dlid/text-treeview#readme","devDependencies":{"chalk":"^2.3.2","codecov":"^3.0.2","istanbul":"^0.4.5","jasmine":"^3.1.0","jasmine-node":"^1.14.5","jasmine-reporters":"^2.3.1"},"gitHead":"78c66efea6d2a1b8ce583b96b217db379bb31ddb","_id":"text-treeview@1.0.1","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"dlid","email":"npm@dlid.se"},"dist":{"integrity":"sha512-RyqSxBFuFeZq0Wzspl0ztriQz1ajIa2w9cu6KiPXc9JJD2ygkk4tNmD3vA6eaUc2pSoxXuQGw3U189qgO6VaQg==","shasum":"5231455e1047b66637e133947d087ce1dba5250b","tarball":"https://registry.npmjs.org/text-treeview/-/text-treeview-1.0.1.tgz","fileCount":5,"unpackedSize":10046,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbF8t6CRA9TVsSAnZWagAAxd4QAJkRjiRJa9EGoYLdR/Wy\nbqvLb2KIjmnCWTPMawHw0/X1NlxvnzmIy7bta4RblPsUqZWYvq8CPJhav517\noOM58HxEBdPB6bL4nlatChZfOQzzCSKoX3rQb4cKek4T4wfnvf0qRF2l7RPb\n+T0T7aZl9F2Ex2YpplTDRLVApYXdsdSkM82dwL2lPGIa9t3t93GFrLSJAHzE\nxELdys7Vb4ovbYNE2U1gCKSKqwzugtY1+3KkC8zMLXAnqtciVhrOO9YgvQGI\nHCAT6A2fFOX5z8glCKByIr3EDVa8CZrE3GKk6dTFwF/poUzyCqjcQCGObGJ5\njquNRHSSw+eSKbz4zU/46fYDjGIs+z6qfCEe0zjZpfj5kA5RAKNpk76PU/iw\n13mCwxvo4BeaeUrRkI/Zh9/oXEHJXtMAG+/Czk9fB40B9vnmlPjxbdAkiRYG\nGUsGyGMhoII1wJW/Oj5w5x48YBexBKGQM2wwY/cqx0dXM/JmsTlMVo1n8qda\nszeDH8DPrm/WqPkfbwAjzRBSHsyZYYi1ZzB9hgS9YJDeaQ3S4uZ5nG58JGic\nOYpVt6+ygVmg0wpwkbTQYnL+tyYN9JgVKdiffFtwRs2jDE23/ICcD0nDQkVG\nOwYzvwgtD6zbSVByYVgRM8sL8D8ItAe6rPJIrFnZrabDqLI+Cz/zHzR7V8Oq\nIhVz\r\n=mnJ3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDfU+WQDyZDCEpFuNjBsn324sFFt+R/VUNaH/497wZwYwIhAP/mRtJomypgCRyBqTzCbAg4CdNi7ED1toT27mxOGck+"}]},"maintainers":[{"name":"dlid","email":"npm@dlid.se"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/text-treeview_1.0.1_1528286072539_0.7020903171100843"},"_hasShrinkwrap":false},"1.0.2":{"name":"text-treeview","version":"1.0.2","description":"Create a tree hierarcy for console output","main":"index.js","scripts":{"test":"nyc --reporter=lcov ./node_modules/jasmine/bin/jasmine.js  JASMINE_CONFIG_PATH=./jasmine.json"},"repository":{"type":"git","url":"git+https://github.com/dlid/text-treeview.git"},"keywords":["node","node.js","text","tree","treeview"],"author":{"name":"David Lidström"},"license":"MIT","bugs":{"url":"https://github.com/dlid/text-treeview/issues"},"homepage":"https://github.com/dlid/text-treeview#readme","devDependencies":{"chalk":"^2.3.2","jasmine":"^3.1.0","jasmine-node":"^1.14.5","jasmine-reporters":"^2.3.1","nyc":"^15.1.0"},"gitHead":"5e1a5f65f9db649e141727e78d055b3b826a25cc","_id":"text-treeview@1.0.2","_nodeVersion":"16.13.0","_npmVersion":"7.6.3","dist":{"integrity":"sha512-VrajSWiDpufalLVHo136GZe0nI7+I6DXLmVtuCGIkdXJ0pewVGVSpucZa2lIQMbPqxI8G/b7OA+WRiTdcOUUDw==","shasum":"0c1c86d5af69e95c1dd233bfdf558e8aa1ea1467","tarball":"https://registry.npmjs.org/text-treeview/-/text-treeview-1.0.2.tgz","fileCount":8,"unpackedSize":24435,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh29pgCRA9TVsSAnZWagAA5mMP/3ACI4Q4AVDFW6yiHFAG\n5l6kMrlTMDUqrL5aDApyjRyOLMb7aeF5ysaf/tmjJ2aiYMlrACYK/OR4M3E+\nZ278wdf+EOplcRs8GH+To4g8bgiYwjJT8v5hMNW83xFBY4fvvrbQGCSdvw3o\nYVZvhbiNs6B63utRAk8abUM2kxnghE7SZ01gZW4kts6kwRqScg3j1Zb37Rje\nWLH21ggk9xS3AqT01DKHdrgk9XYG4wNWbvMFHtwvnnO4rKib7ozgczuSCio6\nejpmZBU8pkVuItBr7BTTqdZ6zOUieqnZa86zgTjjT6n2LZOfHzXfThc100o5\nr2dH9QuHnQXvnyCOu5c9pqTJuJqwQ1RbFovqzWgRezJsgsqwSJNv2rBUhCIN\nFOhuhA4I3PNxDUd9oBvxi6ERNV56KJkXjOM1K43BN7o1jXf05lbXeTMTsQBC\n6afYAUwJ9SzLzNPrXQTURjgnSYbKnJabkNqVlwV/IClKmqN2PnbMpVChsqVO\nI8absTiwuvXHfQ/BY404phqTg9e934rFn8idkapnoKWdTBginiGSQYaqbkBD\nAv06/ntd06RYCJPFT+Nm09/GlE4j/dgUCMHq2z5lRbSsA7vNPa9NELsYJuc3\nstEWbv4lEmp8fKuhKPptf+hXKnQ3Oijxe2pmLgrcEVu8rFyVo6OHX53b5i3t\nYG+1\r\n=Vc1f\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAcZn8cvNLyolw+X/pnic4+j9xY/PBaQR4fbfRxHT7hZAiEA62i48EIkorBjWKB1CQ2InkrpRsYeYiCpGby1pggnEQ0="}]},"_npmUser":{"name":"dlid","email":"npm@dlid.se"},"directories":{},"maintainers":[{"name":"dlid","email":"npm@dlid.se"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/text-treeview_1.0.2_1635922567907_0.6176504933659765"},"_hasShrinkwrap":false}},"time":{"created":"2018-03-18T18:09:45.126Z","0.9.0":"2018-03-18T18:09:45.174Z","modified":"2022-05-21T16:12:37.161Z","1.0.0":"2018-03-18T18:40:45.823Z","1.0.1":"2018-06-06T11:54:32.608Z","1.0.2":"2021-11-03T06:56:08.053Z"},"maintainers":[{"name":"dlid","email":"npm@dlid.se"}],"description":"Create a tree hierarcy for console output","homepage":"https://github.com/dlid/text-treeview#readme","keywords":["node","node.js","text","tree","treeview"],"repository":{"type":"git","url":"git+https://github.com/dlid/text-treeview.git"},"author":{"name":"David Lidström"},"bugs":{"url":"https://github.com/dlid/text-treeview/issues"},"license":"MIT","readme":"# text-treeview\r\nnode.js library to write a tree hierarchy for console output.\r\n\r\n[![Build Status](https://travis-ci.org/dlid/text-treeview.svg?branch=master)](https://travis-ci.org/dlid/text-treeview) [![codecov](https://codecov.io/gh/dlid/text-treeview/branch/master/graph/badge.svg)](https://codecov.io/gh/dlid/text-treeview) [![Maintainability](https://api.codeclimate.com/v1/badges/7bb4fc43c7b3b6f0aa5f/maintainability)](https://codeclimate.com/github/dlid/text-treeview/maintainability)\r\n\r\n# The why\r\nWhen writing another library I was working with a deep hierarchy of objects that I had to verify.\r\n\r\nI iterated the objects and wrote some metadata using `space` for indenting the lines. But as the hierarchy became more complex it was difficult to follow.\r\n\r\nSo I wrote a little helper function that could take an array of objects and create a treeview-like experience, making it a lot easer to see the actual structure.\r\n\r\n![treeview](https://assets.dlid.se/7747c114/img/text-treeview.png)\r\n\r\nThen I decided it was an excellent little function to share with everyone.\r\n\r\n# Installation\r\n\r\n```\r\nnpm install text-treeview\r\n```\r\n\r\n# Basic usage\r\n\r\n```\r\nvar tree = require('text-treeview');\r\n\r\nconsole.log(tree([\r\n    {\r\n        text : \"Girls\",\r\n        children : [\r\n            \"Anna\",\r\n            \"Lisa\",\r\n            \"Bea\"\r\n        ]\r\n    },\r\n    {\r\n        text : \"Boys\",\r\n        children : [\r\n            \"Kalle\",\r\n            \"Åre\",\r\n            \"Asgar\"\r\n        ]\r\n    }\r\n]));\r\n\r\n```\r\nWill give you the result:\r\n```\r\n├─ Girls\r\n│  ├─ Anna\r\n│  ├─ Lisa\r\n│  └─ Bea\r\n└─ Boys\r\n   ├─ Kalle\r\n   ├─ Åre\r\n   └─ Asgar\r\n```\r\n\r\n## Tree array\r\n\r\nEach item in the array must be either a string, or an object with a `text` property. You can also use the optional `children` property for an object to add child nodes to the item.\r\n\r\nThe following snippets will yield identical results:\r\n\r\n```\r\nconsole.log(tree([\r\n    \"Hello\",\r\n    \"Hej\",\r\n    \"Hohejoj\"\r\n]));\r\n\r\nconsole.log(tree([\r\n    { text : \"Hello\" },\r\n    { text : \"Hej\" },\r\n    { text : \"Hohejoj\" }\r\n]));\r\n```\r\n\r\n## Children\r\n\r\nEach child item follow the same pattern. A string or the object described above.\r\n\r\n```\r\nconsole.log(tree([\r\n    {\r\n     text : \"Some items\",\r\n     children : [\r\n      \"Item 1\", \r\n      \"Item 2\",\r\n      { \r\n       text : \"Item 3\",\r\n       children : [ \"Item 3.1\", \"Item 3.2\"]\r\n      }\r\n     ]\r\n    }\r\n]));\r\n```\r\nwill give the result\r\n```\r\n└─ Some items\r\n   ├─ Item 1\r\n   ├─ Item 2\r\n   └─ Item 3\r\n      ├─ Item 3.1\r\n      └─ Item 3.2\r\n```\r\n\r\n## Options\r\n\r\nYou pass the options object as the second parameter. These are only a few options and these are the the default ones.\r\n```\r\n{\r\n showRootLines : true,\r\n format : (indents, treeNode, node) => {\r\n    return `${indents.join('')}${treeNode}${node.text}\\n`;\r\n }\r\n}\r\n```\r\n- Set `showRootLines` to false to remove the lines on the root level\r\n- Use `format` to customize each node. See details below.\r\n\r\n### format function\r\n`format (indents, treeNode, node, parentNode)`\r\nThe format function will create each node and will take four parameters\r\n\r\n- `indents` is an array of each treeview \"indent\" that will build the treeview.\r\n   - This array contains all the node indicators further up the tree that other levels and nodes in the tree has created.\r\n   - These are either a NODE `│  ` or EMPTY SPACE `   `. These should be joined toghether and put in front of the string.\r\n- `treeNode` is the actual node indicator for the current node (this is are either a LEAF_NODE (`├─ `) or  END NODE (`└─  `).\r\n- `node` is the node object\r\n- `parentNode` is the parent node of the current node\r\n\r\nThe default function simply looks exactly like this:\r\n\r\n```\r\nfunction format(indents, treeNode, node) {\r\n    return `${indents.join('')}${treeNode}${node.text}\\n`;\r\n}\r\n```\r\n\r\n\r\n# Change log\r\n\r\n - `2021-11-03` - Changed test library and cleaned up references\r\n \r\n","readmeFilename":"README.md","users":{"dlid":true}}