Today we released the latest edition of our Monster project. Monster is a collection of javascript classes that we need for daily work in our web projects.
Besides small helper functions and classes, it also provides useful functions to enable reactive programming.
Monster is available via jsdelivr and npm.
Only the highlights are described here. The full functionality can be found in the documentation.
Node.toString()
The new toString
implementation builds a text output from a tree structure.
First we build a node structure.
const n0 = new Node('abc');
const n1 = new Node('def');
n0.appendChild(n1)
const n11 = new Node('ghi');
n0.appendChild(n11)
const n2 = new Node('jkl');
n1.appendChild(n2);
const n3 = new Node('mno');
n1.appendChild(n3);
const n4 = new Node('pqr');
n2.appendChild(n4);
Now we call toString
of the first node.
n0.toString()
The expected output:
abc
├def
| ├jkl
| | └pqr
| └mno
└ghi
hope you enjoy it!
Top comments (0)