Constimport {Array} from 'effect'
import {drawTree} from 'effect-tree'
const stringTree = of('foo')
const numericTree = of(42)
// Draw a string tree into arrays of rows using default theme.
const stringRows : Array.NonEmptyArray<string> = drawTree(stringTree)
// Draw a numeric tree into arrays of rows using default theme.
const numericRows: Array.NonEmptyArray<string> = drawTree.number(numericTree)
// Draw string trees to a string using default theme for `console.log`, for
// example.
console.log(drawTree.unlines(stringTree))
// Draw numeric trees to a string using default theme.
console.log(drawTree.numeric.unlines(numericTree))
// Draw string trees using a specific theme into rows.
const stringAsciiRows = drawTree.ascii(stringTree))
// Draw string trees using a specific theme into a string.
console.log(drawTree.ascii.unlines(stringTree))
// Draw numeric trees using a specific theme into rows.
const numericAsciiRows = drawTree.ascii.numeric(numericTree))
// Draw numeric trees using a specific theme into a string.
console.log(drawTree.ascii.numeric.unlines(numericTree))
Draw a string or numeric tree into a non-empty array of string rows.
At the key
unlinesyou will find a version the returns a string of the joined rows.At the key
numericyou will find a version that draws numeric trees, and it too has a keyunlineswith a version that draws to strings rather than an array of rows.At each key named after a theme name, you will find a version of the function with its
numericandunlinesvariants, that draws the tree at the given theme.