Skip to content

Instantly share code, notes, and snippets.

@ehynds
Forked from tbranyen/extend.js
Created January 18, 2012 22:33
Show Gist options
  • Save ehynds/1636255 to your computer and use it in GitHub Desktop.
Save ehynds/1636255 to your computer and use it in GitHub Desktop.
Minimalist extend function
function extend() {
var i, prop, source;
var args = Array.prototype.slice.call(arguments);
var destination = args.shift();
for (i=0; i<args.length; i++) {
source = args[i];
for (prop in source) {
destination[prop] = source[prop];
}
}
return destination;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment