(value: unknown)
| 42 | * Check if the value is an object even it created by `Object.create(null)` or more tricky way. |
| 43 | */ |
| 44 | export function isObject(value: unknown): value is Record<PropertyKey, unknown> { |
| 45 | if (!value || typeof value !== 'object') { |
| 46 | return false |
| 47 | } |
| 48 | |
| 49 | const proto = Object.getPrototypeOf(value) |
| 50 | |
| 51 | return proto === Object.prototype || !proto || !proto.constructor |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Check if the value satisfy a `object` type in typescript |
no outgoing calls
no test coverage detected