MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / shallowRecordEqual

Function shallowRecordEqual

packages/core/src/runtime/commit/equality.ts:210–222  ·  view source on GitHub ↗
(
  a: Readonly<Record<string, unknown>>,
  b: Readonly<Record<string, unknown>>,
)

Source from the content-addressed store, hash-verified

208}
209
210function shallowRecordEqual(
211 a: Readonly<Record<string, unknown>>,
212 b: Readonly<Record<string, unknown>>,
213): boolean {
214 const aKeys = Object.keys(a);
215 const bKeys = Object.keys(b);
216 if (aKeys.length !== bKeys.length) return false;
217 for (const key of aKeys) {
218 if (!(key in b)) return false;
219 if (!Object.is(a[key], b[key])) return false;
220 }
221 return true;
222}
223
224export function compositePropsEqual(prev: unknown, next: unknown): boolean {
225 if (Object.is(prev, next)) return true;

Callers 1

compositePropsEqualFunction · 0.85

Calls 1

keysMethod · 0.65

Tested by

no test coverage detected