@woosh/meep-engine 2.47.36 → 2.47.38

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/build/meep.cjs CHANGED
@@ -77598,28 +77598,31 @@ function planesEqual(a, b) {
77598
77598
  * @template T
77599
77599
  * @param {T[]} a
77600
77600
  * @param {T[]} b
77601
- * @param {function(T,T):boolean} elementsEqual
77601
+ * @param {function(T,T):boolean} elements_equal
77602
77602
  * @returns {boolean}
77603
77603
  */
77604
- function isArraysEqualWithComparator(a, b, elementsEqual) {
77604
+ function isArraysEqualWithComparator(a, b, elements_equal) {
77605
77605
  if (a === b) {
77606
+ // same object
77606
77607
  return true;
77607
77608
  }
77608
77609
 
77609
77610
  if (a === null || b === null || a === undefined || b === undefined) {
77611
+ // check if one of the arrays is missing
77610
77612
  return false
77611
77613
  }
77612
77614
 
77613
- const l = a.length;
77614
- if (l !== b.length) {
77615
+ const element_count = a.length;
77616
+
77617
+ if (element_count !== b.length) {
77615
77618
  return false;
77616
77619
  }
77617
77620
 
77618
- for (let i = 0; i < l; i++) {
77621
+ for (let i = 0; i < element_count; i++) {
77619
77622
  const aE = a[i];
77620
77623
  const bE = b[i];
77621
77624
 
77622
- if (!elementsEqual(aE, bE)) {
77625
+ if (!elements_equal(aE, bE)) {
77623
77626
  return false;
77624
77627
  }
77625
77628
  }
@@ -100735,16 +100738,29 @@ function objectDeepEquals(a, b) {
100735
100738
  }
100736
100739
 
100737
100740
  if (tA === "object") {
100738
- //one way
100739
- for (let pA in a) {
100740
- if (!objectDeepEquals(a[pA], b[pA])) {
100741
+ if (Array.isArray(a)) {
100742
+ // special fast path for arrays
100743
+ if (!Array.isArray(b)) {
100744
+ // one is an array, the other is not
100741
100745
  return false;
100742
100746
  }
100747
+ return isArraysEqualWithComparator(a, b, objectDeepEquals);
100743
100748
  }
100744
100749
 
100745
- //other way
100746
- for (let pB in b) {
100747
- if (!objectDeepEquals(a[pB], b[pB])) {
100750
+ const keys_a = Object.keys(a);
100751
+ const keys_b = Object.keys(b);
100752
+
100753
+ if (!isArrayEqualStrict(keys_a, keys_b)) {
100754
+ // different fields
100755
+ return false;
100756
+ }
100757
+
100758
+ const key_count = keys_a.length;
100759
+
100760
+ for (let i = 0; i < key_count; i++) {
100761
+ const key = keys_a[i];
100762
+
100763
+ if (!objectDeepEquals(a[key], b[key])) {
100748
100764
  return false;
100749
100765
  }
100750
100766
  }