0.2.2 • Published 8 years ago

digger-find v0.2.2

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

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!
}
0.2.2

8 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 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