Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

digger-find

binocarlos12MIT0.2.2

The client side find function for digger container trees

digger, find

readme

digger-find

Build status

The client side find function for digger container trees.

Examples

find

Find containers in local data:

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]');

sort

Sort containers by function or fieldname - asc only at present:

By field:

var superheroes = Container(children_data);

// title is default
var byname = superheroes.sort();

// sort by fieldname
var byrating = superheroes.sort('rating');

filter

Return a container with the models that return true from the provided function

If the function is a string then do 'container.match' on it.

By field:

var superheroes = Container(children_data);

var some = superheroes.filter(function(hero){
    return hero.hasClass('super');
})

var byselector = superheroes.filter('.super');

match

Returns true if a given container matches the given selector.

var superheroes = Container(children_data);

var spiderman = superheroes.eq(1);

if(spiderman.match('.super')){
    // spiderman is super!
}