treelib

create trees as simple as path('a/b/c')!

27 个版本
安装
npm install treelib
yarn add treelib
pnpm add treelib
bun add treelib
README

Build Status

treelib : create trees as easy as .path('a/b/c')

const Treelib = require('treelib');
var tree = new Treelib;
tree.path('a/b/c').setValue('foobar');

// { a : { b : { c : 'foobar' }}}

about

This provides a simple way to generate trees.

API

var tree = new Treelib;

starts a new tree object

var tree = new Treelib(obj)

starts a new tree object starting with obj

.path(string)

takes in a string such as "a/b/c"

.pathList(array)

takes in an array such as ["a", "b", "c"]

.pathAndSetValue(string,value)

takes in a string and sets a value there

.pathAndSetValue("a/b/c", "hello");
// { a : { b : { c : "hello" } } }

.pathListAndSetArray(array, value)

.pathListAndSetValue(["a", "b", "c"], "hello");
// { a : { b : { c : "hello" } } }

.getValue(string)

takes in a string and returns value there

.getValue('a/b/c')
// returns "hello"

.getListValue(list)

takes in a list and returns value there

.getListValue(["a","b","c"])
// returns "hello"

.get()

returns the tree

.setValue(value)

sets value at current branch

and that's it!

license

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

版本列表
1.1.3 2017-11-15
1.1.2 2017-11-15
1.1.1 2017-11-15
1.0.0 2017-11-15
0.4.1 2017-01-26
0.4.0 2017-01-26
0.2.0 2016-03-09
0.1.9 2016-01-28
0.1.8 2016-01-27
0.1.7 2016-01-27
0.1.5 2016-01-24
0.1.4 2015-12-30
0.1.3 2015-12-28
0.1.2 2015-12-28
0.1.1 2015-12-28
0.1.0 2015-12-25
0.0.11 2015-12-25
0.0.10 2015-12-25
0.0.9 2015-12-25
0.0.8 2015-09-25
0.0.7 2015-09-25
0.0.6 2013-08-31
0.0.5 2013-08-21
0.0.4 2011-07-27
0.0.3 2011-07-27
0.0.2 2011-07-25
0.0.1 2011-07-25