DEV Community

Cover image for Monster 1.28 released
Volker Schukai for schukai GmbH

Posted on

Monster 1.28 released

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);
Enter fullscreen mode Exit fullscreen mode

Now we call toString of the first node.

n0.toString()
Enter fullscreen mode Exit fullscreen mode

The expected output:

abc
 ├def
 | ├jkl
 | | └pqr
 | └mno
 └ghi
Enter fullscreen mode Exit fullscreen mode

hope you enjoy it!

References

Top comments (0)