Created
February 8, 2014 02:03
-
-
Save RoryDuncan/8875559 to your computer and use it in GitHub Desktop.
Extend the properties of one object into another.
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
// 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