Where to find polyfill for Object.assign #11738
Answered
by
icecream17
icecream17
asked this question in
Q&A
-
Copied from webpack/webpack#14938 I'm looking at the bundle for my sudoku solver (uses create-react-app bundles stored here) and I think this part is a polyfill for Object.assign: function(e){"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function a(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(a){return!1}}()?Object.assign:function(e,o){for(var l,i,u=a(e),s=1;s<arguments.length;s++){for(var c in l=Object(arguments[s]))n.call(l,c)&&(u[c]=l[c]);if(t){i=t(l);for(var f=0;f<i.length;f++)r.call(l,i[f])&&(u[i[f]]=l[i[f]])}}return u}} (semicolons to newline) function(e){"use strict"
var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable
function a(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined")
return Object(e)}e.exports=function(){try{if(!Object.assign)return!1
var e=new String("abc")
if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1
for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n
if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1
var r={}
return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(a){return!1}}()?Object.assign:function(e,o){for(var l,i,u=a(e),s=1;s<arguments.length;s++){for(var c in l=Object(arguments[s]))n.call(l,c)&&(u[c]=l[c])
if(t){i=t(l)
for(var f=0;f<i.length;f++)r.call(l,i[f])&&(u[i[f]]=l[i[f]])}}return u}} Where is the polyfill implemented (the file on Github)? (Wait a minute, all the browsers in my browserslist support Object.assign. Maybe this is something else?) |
Beta Was this translation helpful? Give feedback.
Answered by
icecream17
Dec 13, 2021
Replies: 1 comment
-
I found the answer using the copyright, it's the npm |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
icecream17
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found the answer using the copyright, it's the npm
object-assign
, code here: https://github.com/sindresorhus/object-assign/blob/main/index.js