Skip to content

Instantly share code, notes, and snippets.

@sshmyg
Created December 16, 2015 14:49
Show Gist options
  • Save sshmyg/cfc8b26737b5b3f79e13 to your computer and use it in GitHub Desktop.
Save sshmyg/cfc8b26737b5b3f79e13 to your computer and use it in GitHub Desktop.
SImple extend
var extend = function(target, source) {
target = target || {};
for (var prop in source) {
if (!source.hasOwnProperty(prop)) continue;
if (typeof source[prop] === 'object') {
target[prop] = extend(target[prop], source[prop]);
} else {
target[prop] = source[prop];
}
}
return target;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment