Skip to content

Instantly share code, notes, and snippets.

@beebole
Created October 24, 2014 22:08
var directive = {
'li':{
'animal<-animals':{
'span.name': 'animal.name'
},
// at the same level of the <- loop declaration
// use the keyword: sort
sort: function(a, b){ // same kind of sort as the usual Array sort
var cmp = function(x, y){
return x > y? 1 : x < y ? -1 : 0;
};
return cmp( a.name, b.name );
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment