Skip to content

Instantly share code, notes, and snippets.

@dominykas
Created July 28, 2015 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dominykas/a964a53ef368719b2ab1 to your computer and use it in GitHub Desktop.
Save dominykas/a964a53ef368719b2ab1 to your computer and use it in GitHub Desktop.
function processOneVideo(video, cb) {
if(doesVariableHaveNoValue(video.videotitle)){
video.videotitle="Product video";
}
/* -----+++++-----+++++----- ZALGO TERRITORY -----+++++-----+++++----- */
if(doesVariableHaveNoValue(video.videothumb)){
video.videothumb= urlCorrector.convertUrl(video.videourl,function(err,res){
video.videourl=res;
cb(err);
});
}
else{
urlCorrector.convertUrl(video.videothumb, function (err, res) {
video.videothumb=res;
cb(err);
});
}
}
function processAllVideos(videoList, cb) {
async.map(videoList, processOneVideo, cb);
}
module.exports = processAllVideos;
if (require.main === module) {
processAllVideos([
{ videourl: "http://vimeo.com/blalba" },
{ videourl: "http://youtube.com/blabla" }
], function () {
console.log(arguments);
// arba
if (video[0].videothumb != "blabla") {
console.error("unexpected thumb returned")
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment