Skip to content

Instantly share code, notes, and snippets.

@GirlBossRush
Created September 7, 2015 07:27
Show Gist options
  • Save GirlBossRush/0d81a25cd147b5dac4bf to your computer and use it in GitHub Desktop.
Save GirlBossRush/0d81a25cd147b5dac4bf to your computer and use it in GitHub Desktop.
Converting a method into a function
function funcify (method) {
return function (self) {
return method.apply(self, Array.prototype.slice.call(arguments, 1))
}
}
const map = funcify(Array.prototype.map)
const attributes = map(document.querySelectorAll('div'), element => element.classList)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment