(val)
| 184 | * @returns {boolean} True if value is a plain Object, otherwise false |
| 185 | */ |
| 186 | const isPlainObject = (val) => { |
| 187 | if (!isObject(val)) { |
| 188 | return false; |
| 189 | } |
| 190 | |
| 191 | const prototype = getPrototypeOf(val); |
| 192 | return ( |
| 193 | (prototype === null || |
| 194 | prototype === Object.prototype || |
| 195 | getPrototypeOf(prototype) === null) && |
| 196 | // Treat any genuine (non-Object.prototype-polluted) Symbol.toStringTag or |
| 197 | // Symbol.iterator as evidence the value is a tagged/iterable type rather |
| 198 | // than a plain object, while ignoring keys injected onto Object.prototype. |
| 199 | !hasOwnInPrototypeChain(val, toStringTag) && |
| 200 | !hasOwnInPrototypeChain(val, iterator) |
| 201 | ); |
| 202 | }; |
| 203 | |
| 204 | /** |
| 205 | * Determine if a value is an empty object (safely handles Buffers) |
no test coverage detected