Skip to content

Instantly share code, notes, and snippets.

@scneptune
Created April 7, 2016 23:35
Show Gist options
  • Save scneptune/c5e54e46c30f41b3399f7456083b9201 to your computer and use it in GitHub Desktop.
Save scneptune/c5e54e46c30f41b3399f7456083b9201 to your computer and use it in GitHub Desktop.
A method to harmonize using the key property names for either featured videos or branded videos.
function findVideoContext(context) {
switch (context) {
case 'branded_videos':
case 'branded_video_ids':
return {
presenterContext: 'branded_videos',
viewContext: 'branded_video_ids'
};
case 'featured_videos':
case 'featured_video_ids':
return
default:
console.error('no context passed', context);
break;
}
}
//eg like ..
var videoContext = findVideoContext(context); //imagine this is 'branded_videos'
videoContext.presenterContext; // 'branded_videos'
videoContext.viewContext; // 'branded_video_ids'
var secondContext = findVideoContext('featured_video_ids')
secondContext.presenterContext; //'featured_videos'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment