tree-to-string

Convert a tree structure into a human friendly string

  • 所有者: mafintosh/tree-to-string
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

tree-to-string

npm install tree-to-string

Usage

const treeToString = require('tree-to-string')

const tree = {
  value: [7],
  children: [{
    value: [3, 5],
    children: [{
      value: [2]
    }, {
      value: [4]
    }, {
      value: [6]
    }]
  }, {
    value: [8]
  }]
}

console.log(treeToString(tree))

Running the above prints something similar to

[ 2 ]─┐
      │
[ 4 ]─┼─[ 3, 5 ]─┐
      │          │
[ 6 ]─┘          ├─[ 7 ]
                 │
           [ 8 ]─┘

API

const str = treeToString(tree, [format])

Converts a tree to a human friendly string.
The tree should have a layout similar to this

{
  value: someJsObject,
  children: [tree, ...]
}

Format defaults to util.inspect. Change this to your
own method that pretty prints your object if your prefer.

License

MIT

主要指標

概覽
名稱與所有者mafintosh/tree-to-string
主編程語言JavaScript
編程語言JavaScript (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2018-06-20 11:50:27
推送於2018-06-21 13:31:01
最后一次提交2018-06-21 15:30:30
發布數3
最新版本名稱v1.1.1 (發布於 2018-06-21 15:30:30)
第一版名稱v1.0.0 (發布於 2018-06-20 13:50:45)
用户参与
星數121
關注者數2
派生數5
提交數7
已啟用問題?
問題數0
打開的問題數0
拉請求數1
打開的拉請求數0
關閉的拉請求數1
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?