0.2.7 • Published 3 months ago

@playableprints/lothlorien v0.2.7

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

lothlorien exports two trees, some helpers and a bunch of types.

Tree

import { Tree } from "@playableprints/lothlorien";

// Create a new tree
const tree = new Tree();

// Add a root node
tree.addRoot("/", { counter: 0 });

// Add some leaves
tree.addLeaf("/one", "/", { counter: 1 });
tree.addLeaf("/one/two", "/one", { counter: 2 });
tree.addLeaf("/three", "/", { counter: 3 });

// Print out the structure, in a depth-first way
const treeoutput = tree.deepPairs();

console.log(treeoutput);
/* Prints:

[
  { key: '/', value: { counter: 0 } },
  { key: '/one', value: { counter: 1 } },
  { key: '/one/two', value: { counter: 2 } },
  { key: '/three', value: { counter: 3 } }
]

*/

See the basic example code for a working example.

SortedTree

treeutil

Types

0.2.7

3 months ago

0.2.6

3 months ago

0.2.5

3 months ago

0.2.3

4 months ago

0.2.4

4 months ago

0.2.1

4 months ago

0.2.0

4 months ago

0.2.2

4 months ago

0.1.14

4 months ago

0.1.15

4 months ago

0.1.10

5 months ago

0.1.11

5 months ago

0.1.12

5 months ago

0.1.13

5 months ago

0.1.9

5 months ago

0.1.8

5 months ago

0.1.7

5 months ago

0.1.6

5 months ago

0.1.5

5 months ago

0.1.4

5 months ago

0.1.3

5 months ago

0.1.2

5 months ago

0.1.1

6 months ago

0.1.0

6 months ago