UNPKG

@storm-stack/types

Version:

⚡ The storm-stack monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.

21 lines (20 loc) 653 B
export const isEqual = (x, y) => { if (Object.is(x, y)) return true; if (x instanceof Date && y instanceof Date) { return x.getTime() === y.getTime(); } if (x instanceof RegExp && y instanceof RegExp) { return x.toString() === y.toString(); } if (typeof x !== "object" || x === null || typeof y !== "object" || y === null) { return false; } const keysX = Reflect.ownKeys(x); const keysY = Reflect.ownKeys(y); if (keysX.length !== keysY.length) return false; for (const element_ of keysX) { if (!Reflect.has(y, element_)) return false; if (!isEqual(x[element_], y[element_])) return false; } return true; };