Skip to content

Instantly share code, notes, and snippets.

@martino
Created March 28, 2012 11:50
Show Gist options
  • Save martino/2225600 to your computer and use it in GitHub Desktop.
Save martino/2225600 to your computer and use it in GitHub Desktop.
jslint switch indent
function CreateNewSearchItem(itemType) {
var newItem = null, view = null;
switch (itemType) {
case 'image':
newItem = MediaBox.Models.ImageMediaItem;
view = MediaBox.Views.ImageSearchItem;
break;
case 'document':
newItem = MediaBox.Models.DocumentMediaItem;
view = MediaBox.Views.DocumentSearchItem;
break;
case 'audio':
newItem = MediaBox.Models.AudioMediaItem;
view = MediaBox.Views.AudioSearchItem;
break;
case 'url':
newItem = MediaBox.Models.UrlMediaItem;
view = MediaBox.Views.UrlSearchItem;
break;
}
return {itemClass: newItem, viewClass: view};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment