Skip to content

Instantly share code, notes, and snippets.

@gregdangelo
Created April 9, 2012 12:34
Show Gist options
  • Save gregdangelo/2343158 to your computer and use it in GitHub Desktop.
Save gregdangelo/2343158 to your computer and use it in GitHub Desktop.
Javascript Deep Extend with no framework
Object.deepExtend = function(destination, source) {
for (var property in source) {
if (source[property] && source[property].constructor &&
source[property].constructor === Object) {
destination[property] = destination[property] || {};
arguments.callee(destination[property], source[property]);
} else {
destination[property] = source[property];
}
}
return destination;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment