mol_plot_all 1.2.547 → 1.2.549

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/node.test.js CHANGED
@@ -915,7 +915,9 @@ var $;
915
915
  }
916
916
  let result;
917
917
  try {
918
- if (left_proto && !Reflect.getPrototypeOf(left_proto))
918
+ if (!left_proto)
919
+ result = compare_pojo(left, right);
920
+ else if (!Reflect.getPrototypeOf(left_proto))
919
921
  result = compare_pojo(left, right);
920
922
  else if (Array.isArray(left))
921
923
  result = compare_array(left, right);
@@ -983,10 +985,18 @@ var $;
983
985
  function compare_pojo(left, right) {
984
986
  const left_keys = Object.getOwnPropertyNames(left);
985
987
  const right_keys = Object.getOwnPropertyNames(right);
986
- if (left_keys.length !== right_keys.length)
988
+ if (!compare_array(left_keys, right_keys))
987
989
  return false;
988
990
  for (let key of left_keys) {
989
- if (!$mol_compare_deep(left[key], Reflect.get(right, key)))
991
+ if (!$mol_compare_deep(left[key], right[key]))
992
+ return false;
993
+ }
994
+ const left_syms = Object.getOwnPropertySymbols(left);
995
+ const right_syms = Object.getOwnPropertySymbols(right);
996
+ if (!compare_array(left_syms, right_syms))
997
+ return false;
998
+ for (let key of left_syms) {
999
+ if (!$mol_compare_deep(left[key], right[key]))
990
1000
  return false;
991
1001
  }
992
1002
  return true;
@@ -6505,8 +6515,9 @@ var $;
6505
6515
  $mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
6506
6516
  $mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
6507
6517
  $mol_assert_not($mol_compare_deep({}, { a: undefined }));
6508
- $mol_assert_ok($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
6518
+ $mol_assert_not($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
6509
6519
  $mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
6520
+ $mol_assert_ok($mol_compare_deep(Object.create(null), Object.create(null)));
6510
6521
  },
6511
6522
  'Array'() {
6512
6523
  $mol_assert_ok($mol_compare_deep([], []));
@@ -6521,6 +6532,11 @@ var $;
6521
6532
  $mol_assert_not($mol_compare_deep(() => 1, () => 1));
6522
6533
  $mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
6523
6534
  },
6535
+ 'POJO with symbols'() {
6536
+ const sym = Symbol();
6537
+ $mol_assert_ok($mol_compare_deep({ [sym]: true }, { [sym]: true }));
6538
+ $mol_assert_not($mol_compare_deep({ [Symbol()]: true }, { [Symbol()]: true }));
6539
+ },
6524
6540
  'same POJOs with cyclic reference'() {
6525
6541
  const a = { foo: {} };
6526
6542
  a['self'] = a;