Created
August 30, 2012 16:23
-
-
Save robdodson/3532283 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
| function test(arg){ | |
| return arg + arg; | |
| } | |
| function testDecorator(fn, args){ | |
| var arg = args[0] * 2; | |
| return fn(arg); | |
| } | |
| function decorate(dec, fn, args){ | |
| return function(){ | |
| return dec(fn, args); | |
| } | |
| } | |
| x = decorate(testDecorator, test, [2])(); | |
| console.log(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment