Created
September 12, 2016 20:11
-
-
Save afuggini/3b9430a9f3c6f181f16c4ac66cdad958 to your computer and use it in GitHub Desktop.
Vanilla object extend function (UnderscoreJS)
This file contains hidden or 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
var extend = function() { | |
var extended = {}; | |
for(key in arguments) { | |
var argument = arguments[key]; | |
for (prop in argument) { | |
if (Object.prototype.hasOwnProperty.call(argument, prop)) { | |
extended[prop] = argument[prop]; | |
} | |
} | |
} | |
return extended; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment