const Treelib = require('treelib');
var tree = new Treelib;
tree.path('a/b/c').setValue('foobar');
// { a : { b : { c : 'foobar' }}}
This provides a simple way to generate trees.
starts a new tree object
starts a new tree object starting with obj
takes in a string such as "a/b/c"
takes in an array such as ["a", "b", "c"]
takes in a string and sets a value there
.pathAndSetValue("a/b/c", "hello");
// { a : { b : { c : "hello" } } }
.pathListAndSetValue(["a", "b", "c"], "hello");
// { a : { b : { c : "hello" } } }
takes in a string and returns value there
.getValue('a/b/c')
// returns "hello"
takes in a list and returns value there
.getListValue(["a","b","c"])
// returns "hello"
returns the tree
sets value at current branch
node-treelib Copyright (c) 2010-2017 David Wee rook2pawn@gmail.com MIT Free software provided under the MIT License http://opensource.org/licenses/mit-license.php