-
-
Save ehynds/1636255 to your computer and use it in GitHub Desktop.
Minimalist extend function
This file contains 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
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