(obj)
| 5 | * @returns {boolean} True if the argument appears to be a plain object. |
| 6 | */ |
| 7 | export default function isPlainObject(obj) { |
| 8 | if (!obj || typeof obj !== 'object') { |
| 9 | return false |
| 10 | } |
| 11 | |
| 12 | const proto = typeof obj.constructor === 'function' ? |
| 13 | Object.getPrototypeOf(obj) : |
| 14 | Object.prototype |
| 15 | |
| 16 | if (proto === null) { |
| 17 | return true |
| 18 | } |
| 19 | |
| 20 | const constructor = proto.constructor |
| 21 | |
| 22 | return typeof constructor === 'function' |
| 23 | && constructor instanceof constructor |
| 24 | && fnToString(constructor) === fnToString(Object) |
| 25 | } |
no test coverage detected
searching dependent graphs…