Created
April 1, 2010 20:15
-
-
Save knowuh/352316 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
Object.prototype.clone = function(isDeep) { | |
var key; | |
var return_results = {}; | |
if (isDeep && (typeof this == "object")) { | |
for (key in this) { | |
return_results[key] = this[key].clone(); | |
} | |
} | |
else { | |
return_results = this; | |
} | |
return return_results; | |
}; | |
Object.prototype.merge = function(otherObject) { | |
var key; | |
for (key in otherObject) { | |
if (typeof otherObject[key] != "function") { | |
this[key] = otherObject[key].clone(); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment