Created
June 7, 2015 19:28
-
-
Save justsml/ce1f82472a57fb87b3e6 to your computer and use it in GitHub Desktop.
Inspiration: http://www.2ality.com/2012/01/js-inheritance-by-example.html ... Thanks Axel
This file contains 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 extend(obj, src) { | |
Object.getOwnPropertyNames(src) | |
.forEach( (propName) => Object.defineProperty(obj, propName, Object.getOwnPropertyDescriptor(src, propName)) ); | |
return obj; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment