Repository: reduxjs/react-redux (ts)

Issue:
`isPlainObject()` util returns `false` for objects without prototypes
`Object.create(null)` produces a plain object whose prototype is `null`. Lodash's `isPlainObject()` correctly treats this as a plain object, but the `isPlainObject()` helper introduced in #936 does not. This broke our app, since we have a number of selectors which return prototypeless objects.

PR to follow.

Pull request description:
Treat `null` as a valid plain object prototype in `isPlainObject()`
Fixes #1074

Patch:
diff --git a/src/utils/isPlainObject.js b/src/utils/isPlainObject.js
index 3560c2c..0c74b62 100644
--- a/src/utils/isPlainObject.js
+++ b/src/utils/isPlainObject.js
@@ -5,10 +5,13 @@
 export default function isPlainObject(obj) {
   if (typeof obj !== 'object' || obj === null) return false
 
-  let proto = obj
-  while (Object.getPrototypeOf(proto) !== null) {
-    proto = Object.getPrototypeOf(proto)
+  let proto = Object.getPrototypeOf(obj)
+  if (proto === null) return true
+
+  let baseProto = proto
+  while (Object.getPrototypeOf(baseProto) !== null) {
+    baseProto = Object.getPrototypeOf(baseProto)
   }
 
-  return Object.getPrototypeOf(obj) === proto
+  return proto === baseProto
 }


Test patch:
diff --git a/test/utils/isPlainObject.spec.js b/test/utils/isPlainObject.spec.js
index f8addd7..9b173f2 100644
--- a/test/utils/isPlainObject.spec.js
+++ b/test/utils/isPlainObject.spec.js
@@ -17,5 +17,6 @@ describe('isPlainObject', () => {
     expect(isPlainObject(null)).toBe(false)
     expect(isPlainObject()).toBe(false)
     expect(isPlainObject({ x: 1, y: 2 })).toBe(true)
+    expect(isPlainObject(Object.create(null))).toBe(true)
   })
 })