MCPcopy
hub / github.com/TanStack/query / shallowEqualObjects

Function shallowEqualObjects

packages/query-core/src/utils.ts:306–321  ·  view source on GitHub ↗
(
  a: T,
  b: T | undefined,
)

Source from the content-addressed store, hash-verified

304 * Shallow compare objects.
305 */
306export function shallowEqualObjects<T extends Record<string, any>>(
307 a: T,
308 b: T | undefined,
309): boolean {
310 if (!b || Object.keys(a).length !== Object.keys(b).length) {
311 return false
312 }
313
314 for (const key in a) {
315 if (a[key] !== b[key]) {
316 return false
317 }
318 }
319
320 return true
321}
322
323export function isPlainArray(value: unknown): value is Array<unknown> {
324 return Array.isArray(value) && value.length === Object.keys(value).length

Callers 6

setOptionsMethod · 0.90
updateResultMethod · 0.90
setOptionsMethod · 0.90
setQueriesMethod · 0.90
utils.test.tsxFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…