Created
July 22, 2016 20:24
-
-
Save trickycoders/e5d78e6003b653a3c2ad261e0ec681ac to your computer and use it in GitHub Desktop.
Object.assign polyfill
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
if(!Object.assign){ | |
Object.prototype.assign(target) | |
var from; | |
var keys; | |
var to = target; | |
for (var s = 1; s < arguments.length; s++) { | |
from = arguments[s]; | |
keys = Object.keys(Object(from)); | |
for (var i = 0; i < keys.length; i++) { | |
to[keys[i]] = from[keys[i]]; | |
} | |
} | |
return to; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment