MCPcopy Create free account
hub / github.com/TanStack/query / isPlainObject

Function isPlainObject

packages/query-devtools/src/utils.tsx:216–235  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

214 * @returns Whether the value can be copied as a record.
215 */
216export 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.

Callers 3

ExplorerFunction · 0.90
updateNestedDataByPathFunction · 0.70
deleteNestedDataByPathFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected