Created
July 6, 2016 16:03
-
-
Save damaon/689425acac1a805a517bdb78cde2d9ee 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
# withFn(name, function, arguments) | |
augument = (object, withFn) -> | |
_.each _.keys(object), (name) -> | |
fn = object[name] | |
if (typeof fn == 'function') | |
object[name] = ((name, fn) -> | |
args = arguments | |
-> | |
withFn.apply(this, [args[0], args[1], arguments]) | |
fn.apply(this, arguments) | |
)(name, fn) | |
# Returned: | |
(actions) -> | |
augument(actions, (name, f, args) -> console.log("Action:#{name}", args)) | |
actions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment