(value: unknown)
| 214 | * @returns Whether the value can be copied as a record. |
| 215 | */ |
| 216 | export function isPlainObject(value: unknown): boolean { |
| 217 | if (value === null || typeof value !== 'object') return false |
| 218 | try { |
| 219 | const prototype = Object.getPrototypeOf(value) |
| 220 | if (prototype === null) return true |
| 221 | const constructor = Object.getOwnPropertyDescriptor( |
| 222 | prototype, |
| 223 | 'constructor', |
| 224 | )?.value |
| 225 | return ( |
| 226 | typeof constructor === 'function' && |
| 227 | Object.getOwnPropertyDescriptor(constructor, 'prototype')?.value === |
| 228 | prototype && |
| 229 | Function.prototype.toString.call(constructor) === |
| 230 | Function.prototype.toString.call(Object) |
| 231 | ) |
| 232 | } catch { |
| 233 | return false |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * Updates nested data by path. |
no outgoing calls
no test coverage detected