Skip to content

Instantly share code, notes, and snippets.

@steam
Created October 15, 2010 22:23
Show Gist options
  • Save steam/629075 to your computer and use it in GitHub Desktop.
Save steam/629075 to your computer and use it in GitHub Desktop.
function getCarsByBodyStyle( allModels, allBodyStyles, selectedBodyStyles ){
var cars = [];
var excludedBodyStyles = _.without.apply( this, [allBodyStyles].concat(selectedBodyStyles) );
_.each(allModels, function(model){
if( _.intersect( model.bodyTypes, excludedBodyStyles ).length == 0 ){
cars.push( parseInt( model.id ) );
}
});
return cars;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment