0.0.15-beta.1 • Published 10 years ago
thin-tree v0.0.15-beta.1
thin-tree 
Thin tree helps build recursive structures.
Usage
var TT = require('thin-tree');
var eve = {
name: "Eve",
children: [
{
name: "Alice",
age: 7
},
{
name: "Bob",
age: 5
}
]
}
var eveTree = new TT.Find(eve);
expect('Alice' === eveTree.first().name).toBe(true);
expect('Alice' === eveTree.chain()
.where({parent: eveTree})
.first().value().name).toBe(true);
expect('Bob' === eveTree.find({age: 5}).name).toBe(true);
var SomeTree = TT.Find.extend({
prev: function() {
return !this.parent ? null
: this.parent.at(this.index() - 1);
},
next: function() {
return !this.parent ? null
: this.parent.at(this.index() + 1);
}
});
var someEveTree = new SomeTree(eve);
// Inheritance broken
expect(someEveTree.first().next().name).toBe('Bob'); // Fails
0.0.15-beta.1
10 years ago
0.0.15
10 years ago
0.0.14
10 years ago
0.0.13
10 years ago
0.0.12
11 years ago
0.0.11
11 years ago
0.0.10
11 years ago
0.0.9
11 years ago
0.0.8
11 years ago
0.0.7
11 years ago
0.0.6
11 years ago
0.0.5
11 years ago
0.0.4
11 years ago
0.0.3
11 years ago
0.0.2
11 years ago
0.0.1
11 years ago
0.0.0
11 years ago