Created
July 28, 2015 12:41
-
-
Save dominykas/a964a53ef368719b2ab1 to your computer and use it in GitHub Desktop.
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 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