Skip to content

Instantly share code, notes, and snippets.

@RoryDuncan
Created February 8, 2014 02:03
Show Gist options
  • Save RoryDuncan/8875559 to your computer and use it in GitHub Desktop.
Save RoryDuncan/8875559 to your computer and use it in GitHub Desktop.
Extend the properties of one object into another.
// functionality similar (if not the same) as _'s extend method
var extend = function(){
if (arguments.length < 2) return;
var extended = arguments[0];
for (var _x = 1, _xx = arguments.length; _x < _xx; _x++) {
var base = arguments[_x];
for (var key in base) {
extended[key] = base[key];
}
}
return extended;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment