Created
December 4, 2014 12:25
-
-
Save P-Seebauer/904b66d4ef9fca51d207 to your computer and use it in GitHub Desktop.
fluendo checking for method existence
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
# somewhere | |
extendMaybe = (classObjs...) -> | |
for classObj in classObjs | |
(methodName, method) -> classObj::[methodName] = method unless classObj::[methodName]? | |
# top of your file: | |
[extend] = extendMaybe String | |
# usage: | |
extend "append", (stringToAppend)-> @ + if stringToAppend then stringToAppend else '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment