Skip to content

Instantly share code, notes, and snippets.

@rafaelrinaldi
Created February 11, 2016 00:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaelrinaldi/43813e707970bd2d77fa to your computer and use it in GitHub Desktop.
Save rafaelrinaldi/43813e707970bd2d77fa to your computer and use it in GitHub Desktop.
`Object.assign` for browsers that don't support it
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