UNPKG

autumn-js

Version:
24 lines (21 loc) 694 B
"use client"; // src/libraries/react/utils/compareParams.ts var compareParams = (a, b) => { if (a === b) return true; if (a === null || b === null) return false; if (typeof a !== "object" || typeof b !== "object") return false; if (Array.isArray(a) && Array.isArray(b)) { if (a.length !== b.length) return false; return a.every((item, index) => compareParams(item, b[index])); } const keysA = Object.keys(a); const keysB = Object.keys(b); if (keysA.length !== keysB.length) return false; return keysA.every((key) => { if (!Object.prototype.hasOwnProperty.call(b, key)) return false; return compareParams(a[key], b[key]); }); }; export { compareParams };