Created
April 7, 2016 23:35
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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