mol_data_all 1.1.153 → 1.1.154

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
@@ -848,6 +848,21 @@ var $;
848
848
  $.$mol_assert_ok($.$mol_compare_deep(new Uint8Array([0]), new Uint8Array([0])));
849
849
  $.$mol_assert_not($.$mol_compare_deep(new Uint8Array([0]), new Uint8Array([1])));
850
850
  },
851
+ 'Custom comparator'() {
852
+ class User {
853
+ name;
854
+ rand;
855
+ constructor(name, rand = Math.random()) {
856
+ this.name = name;
857
+ this.rand = rand;
858
+ }
859
+ [Symbol.toPrimitive](mode) {
860
+ return this.name;
861
+ }
862
+ }
863
+ $.$mol_assert_ok($.$mol_compare_deep(new User('Jin'), new User('Jin')));
864
+ $.$mol_assert_not($.$mol_compare_deep(new User('Jin'), new User('John')));
865
+ },
851
866
  });
852
867
  })($ || ($ = {}));
853
868
  //deep.test.js.map
@@ -903,6 +918,8 @@ var $;
903
918
  result = compare_map(left, right);
904
919
  else if (ArrayBuffer.isView(left))
905
920
  result = compare_buffer(left, right);
921
+ else if (Symbol.toPrimitive in left)
922
+ result = compare_primitive(left, right);
906
923
  else
907
924
  result = false;
908
925
  }
@@ -967,6 +984,9 @@ var $;
967
984
  }
968
985
  return true;
969
986
  }
987
+ function compare_primitive(left, right) {
988
+ return Object.is(left[Symbol.toPrimitive]('default'), right[Symbol.toPrimitive]('default'));
989
+ }
970
990
  })($ || ($ = {}));
971
991
  //deep.js.map
972
992
  ;
@@ -1562,6 +1582,10 @@ var $;
1562
1582
  'format typed'() {
1563
1583
  $.$mol_assert_equal(new $.$mol_time_duration('P1Y2M3DT4h5m6s').toString('P#Y#M#DT#h#m#s'), 'P1Y2M3DT4H5M6S');
1564
1584
  },
1585
+ 'comparison'() {
1586
+ const iso = 'P1Y1M1DT1h1m1s';
1587
+ $.$mol_assert_like(new $.$mol_time_duration(iso), new $.$mol_time_duration(iso));
1588
+ },
1565
1589
  });
1566
1590
  })($ || ($ = {}));
1567
1591
  //duration.test.js.map
@@ -1661,6 +1685,9 @@ var $;
1661
1685
  toString(pattern = 'P#Y#M#DT#h#m#s') {
1662
1686
  return super.toString(pattern);
1663
1687
  }
1688
+ [Symbol.toPrimitive](mode) {
1689
+ return mode === 'number' ? this.valueOf() : this.toString();
1690
+ }
1664
1691
  static patterns = {
1665
1692
  '#Y': (duration) => {
1666
1693
  if (!duration.year)