Skip to content

Instantly share code, notes, and snippets.

@outbreak
Created September 13, 2017 04:18
Show Gist options
  • Save outbreak/b18ea6ff5cdaf3f0741af1edb97c2fe4 to your computer and use it in GitHub Desktop.
Save outbreak/b18ea6ff5cdaf3f0741af1edb97c2fe4 to your computer and use it in GitHub Desktop.
// addTo :: HTML, HTML -> HTML
function addTo(container, html) {
$(container).append(html)
return container
}
// addAllTo :: HTML, [HTML] -> HTML
function addAllTo(container, htmls) {
htmls.map(function(html){ addTo(container, html) })
return container
}
// Or, we can go use our Curry friend and make it better-er
var addTo = curry(2, addTo)
var addAllTo = curry(2, function(container, htmls) {
htmls.map(addTo(container))
return container
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment