immutable-js-oss/immutable-js

[Bug] isPlainObj fn not compatible for IE11

Closed this issue · 2 comments

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

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' }});