Created
February 11, 2016 00:44
-
-
Save rafaelrinaldi/43813e707970bd2d77fa to your computer and use it in GitHub Desktop.
`Object.assign` for browsers that don't support it
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 mixin(target, source) { | |
var from; | |
var to = target; | |
var index = 0; | |
var total = arguments.length; | |
var hasOwnProperty = Object.prototype.hasOwnProperty; | |
while(++index < total){ | |
from = arguments[index]; | |
if (from != null) { | |
for(var key in from) { | |
if (hasOwnProperty.call(from, key)) { | |
to[key] = from[key]; | |
} | |
} | |
} | |
} | |
return to; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment