Created
November 29, 2011 12:31
-
-
Save jacobrask/1404650 to your computer and use it in GitHub Desktop.
Object.extend suggestion in CoffeeScript
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
| unless typeof Object.extend is 'function' | |
| Object.defineProperty Object, 'extend', | |
| value: (orig, ext) -> | |
| props = {} | |
| for name in Object.getOwnPropertyNames(ext) when name not in orig | |
| props[name] = Object.getOwnPropertyDescriptor ext, name | |
| Object.create orig, props | |
| configurable: true | |
| writable: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment