Skip to content

Instantly share code, notes, and snippets.

@rcallahan rcallahan/gist:0748c6b40f590d43e096 Secret
Last active Dec 20, 2015

Embed
What would you like to do?
sciencedirect = {
doi: munk.select("#ddDoi")
.bind(function(a) { return a.href})
.bind(function(a) { return a.split("org/")[1]}),
attachments: [munk.select(".icon-pdf a").href()]
}
/* .bind(fn) composes fn with the previous returned value
fn is additionally called with the values of previous returned values as arguments
(munk.bind(function(){return 1}).bind(function(){return 2}).bind(function(a,b){return [a,b]}))() evaluates to [2,1]
.bind(function(a) {return a.href}) will be common enough to be sugared to .attr("href") or .href()
.select is sugar for .bind(function(a){return Sizzle(a)})
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.