[Bug] isPlainObj fn not compatible for IE11
Closed this issue · 2 comments
Methuselah96 commented
From @binarykitchen on Thu, 31 Oct 2019 02:53:06 GMT
This implementation is breaking on IE11
function isPlainObj(value) {
return (
value &&
(typeof value.constructor !== 'function' ||
value.constructor.name === 'Object')
);
}
Always returns false.
Refer to https://stackoverflow.com/questions/25140723/constructor-name-is-undefined-in-internet-explorer
Copied from original issue: immutable-js#1745
Methuselah96 commented
Related: immutable-js#1648
bdurrer commented
The current function also fails to correctly detect objects which have property 'constructor' that has a property 'name':
// will return false
isPlainObj({ constructor: { name: 'bamboozled' }});