Created
January 27, 2016 11:25
-
-
Save teebot/03bda6fada586fa5fa90 to your computer and use it in GitHub Desktop.
Wrap multiple functions in one
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
const fnWrapper = (...args) => () => args.forEach(f => f()); | |
const method1 = document.write.bind(document, ['hello']); | |
const method2 = document.write.bind(document, ['world']); | |
const wrapped = fnWrapper(method1, method2); | |
wrapped(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
and in coffeescript:
fnWrapper = (args...) -> -> (args).forEach((f) -> f())