@homebound/beam 4.16.0 → 4.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -6312,6 +6312,22 @@ function shallowEqual(objA, objB) {
6312
6312
  if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
6313
6313
  return false;
6314
6314
  }
6315
+ if (objA instanceof Map || objB instanceof Map) {
6316
+ if (!(objA instanceof Map && objB instanceof Map) || objA.size !== objB.size) return false;
6317
+ for (const [key, value] of objA) {
6318
+ if (!objB.has(key) || !Object.is(value, objB.get(key))) return false;
6319
+ }
6320
+ return true;
6321
+ }
6322
+ if (objA instanceof Set || objB instanceof Set) {
6323
+ if (!(objA instanceof Set && objB instanceof Set) || objA.size !== objB.size) return false;
6324
+ for (const value of objA) {
6325
+ if (!objB.has(value)) return false;
6326
+ }
6327
+ return true;
6328
+ }
6329
+ if (Array.isArray(objA) !== Array.isArray(objB)) return false;
6330
+ if (!Array.isArray(objA) && (!isPlainObject(objA) || !isPlainObject(objB))) return false;
6315
6331
  const keysA = Object.keys(objA);
6316
6332
  const keysB = Object.keys(objB);
6317
6333
  if (keysA.length !== keysB.length) {
@@ -6319,12 +6335,16 @@ function shallowEqual(objA, objB) {
6319
6335
  }
6320
6336
  for (let i = 0; i < keysA.length; i++) {
6321
6337
  const currentKey = keysA[i];
6322
- if (!objB.hasOwnProperty(currentKey) || !Object.is(objA[currentKey], objB[currentKey])) {
6338
+ if (!Object.prototype.hasOwnProperty.call(objB, currentKey) || !Object.is(objA[currentKey], objB[currentKey])) {
6323
6339
  return false;
6324
6340
  }
6325
6341
  }
6326
6342
  return true;
6327
6343
  }
6344
+ function isPlainObject(value) {
6345
+ const prototype = Object.getPrototypeOf(value);
6346
+ return prototype === Object.prototype || prototype === null;
6347
+ }
6328
6348
 
6329
6349
  // src/hooks/useComputed.ts
6330
6350
  function useComputed(fn, deps) {