MCPcopy
hub / github.com/slopus/happy / deepEqual

Method deepEqual

packages/happy-app/sources/dev/testRunner.ts:240–266  ·  view source on GitHub ↗
(a: any, b: any)

Source from the content-addressed store, hash-verified

238 }
239
240 private deepEqual(a: any, b: any): boolean {
241 if (a === b) return true;
242
243 if (a instanceof Uint8Array && b instanceof Uint8Array) {
244 if (a.length !== b.length) return false;
245 for (let i = 0; i < a.length; i++) {
246 if (a[i] !== b[i]) return false;
247 }
248 return true;
249 }
250
251 if (a && b && typeof a === 'object' && typeof b === 'object') {
252 const keysA = Object.keys(a);
253 const keysB = Object.keys(b);
254
255 if (keysA.length !== keysB.length) return false;
256
257 for (const key of keysA) {
258 if (!keysB.includes(key)) return false;
259 if (!this.deepEqual(a[key], b[key])) return false;
260 }
261
262 return true;
263 }
264
265 return false;
266 }
267}
268
269// Global test runner instance

Callers 1

toEqualMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected