-
-
Save jaredatron/206598 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
wooooot |
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
clear(); | |
Object.extend = function(destination, source) { | |
for (var property in source) | |
destination[property] = source[property]; | |
return destination; | |
}; | |
Object.cloneWithInheritance = function(source, extension){ | |
var sourceClass = function(){}; | |
sourceClass.prototype = source; | |
var instance = new sourceClass(); | |
if (extension) Object.extend(instance, extension); | |
return instance; | |
}; | |
var my_methods = { | |
do_something: function(){}, | |
name: 'whatever' | |
} | |
var my_other_methods = Object.cloneWithInheritance(my_methods,{ | |
do_more: function(){}, | |
and_more: function(){}, | |
}); | |
my_other_methods |
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
woot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment