The client side find function for digger container trees
npm install digger-finddigger-find
===========
The client side find function for digger container trees.
``js
var children_data = [{
name:"Superman",
rating:7.8,
_children:[{
name:"flying"
},{
name:"strength"
}]
},{
name:"Spiderman",
rating:7.9,
_children:[{
name:"spinwebs"
},{
name:"spidersense"
}]
}]
var superheroes = Container(children_data);
var spiderman = superheroes.find('[rating=7.9]');
`
By field:
`js
var superheroes = Container(children_data);
// title is default
var byname = superheroes.sort();
// sort by fieldname
var byrating = superheroes.sort('rating');
`
If the function is a string then do 'container.match' on it.
By field:
`js
var superheroes = Container(children_data);
var some = superheroes.filter(function(hero){
return hero.hasClass('super');
})
var byselector = superheroes.filter('.super');
`
`js
var superheroes = Container(children_data);
var spiderman = superheroes.eq(1);
if(spiderman.match('.super')){
// spiderman is super!
}
``