Created
March 18, 2016 06:17
-
-
Save idettman/a1b9a4662bc0cdcd0791 to your computer and use it in GitHub Desktop.
JavaScript Unary Decorator
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 unary(fn) | |
| { | |
| if (fn.length == 1) | |
| { | |
| return fn; | |
| } | |
| else return function(item) | |
| { | |
| return fn.call(this, item); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment