(o: any)
| 391 | |
| 392 | // Copied from: https://github.com/jonschlinkert/is-plain-object |
| 393 | export function isPlainObject(o: any): o is Object { |
| 394 | if (!hasObjectPrototype(o)) { |
| 395 | return false |
| 396 | } |
| 397 | |
| 398 | // If has modified constructor |
| 399 | const ctor = o.constructor |
| 400 | if (typeof ctor === 'undefined') { |
| 401 | return true |
| 402 | } |
| 403 | |
| 404 | // If has modified prototype |
| 405 | const prot = ctor.prototype |
| 406 | if (!hasObjectPrototype(prot)) { |
| 407 | return false |
| 408 | } |
| 409 | |
| 410 | // If constructor does not have an Object-specific method |
| 411 | if (!prot.hasOwnProperty('isPrototypeOf')) { |
| 412 | return false |
| 413 | } |
| 414 | |
| 415 | // Most likely a plain Object |
| 416 | return true |
| 417 | } |
| 418 | |
| 419 | function hasObjectPrototype(o: any): boolean { |
| 420 | return Object.prototype.toString.call(o) === '[object Object]' |
no test coverage detected
searching dependent graphs…