mol_jsx_lib 0.0.397 → 0.0.398
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.deps.json +1 -1
- package/node.js +13 -3
- package/node.js.map +1 -1
- package/node.mjs +13 -3
- package/node.mjs.map +1 -1
- package/node.test.js +20 -4
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.deps.json +1 -1
- package/web.js +13 -3
- package/web.js.map +1 -1
- package/web.mjs +13 -3
- package/web.mjs.map +1 -1
- package/web.test.js +7 -1
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -1705,7 +1705,9 @@ var $;
|
|
|
1705
1705
|
}
|
|
1706
1706
|
let result;
|
|
1707
1707
|
try {
|
|
1708
|
-
if (
|
|
1708
|
+
if (!left_proto)
|
|
1709
|
+
result = compare_pojo(left, right);
|
|
1710
|
+
else if (!Reflect.getPrototypeOf(left_proto))
|
|
1709
1711
|
result = compare_pojo(left, right);
|
|
1710
1712
|
else if (Array.isArray(left))
|
|
1711
1713
|
result = compare_array(left, right);
|
|
@@ -1773,10 +1775,18 @@ var $;
|
|
|
1773
1775
|
function compare_pojo(left, right) {
|
|
1774
1776
|
const left_keys = Object.getOwnPropertyNames(left);
|
|
1775
1777
|
const right_keys = Object.getOwnPropertyNames(right);
|
|
1776
|
-
if (left_keys
|
|
1778
|
+
if (!compare_array(left_keys, right_keys))
|
|
1777
1779
|
return false;
|
|
1778
1780
|
for (let key of left_keys) {
|
|
1779
|
-
if (!$mol_compare_deep(left[key],
|
|
1781
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
1782
|
+
return false;
|
|
1783
|
+
}
|
|
1784
|
+
const left_syms = Object.getOwnPropertySymbols(left);
|
|
1785
|
+
const right_syms = Object.getOwnPropertySymbols(right);
|
|
1786
|
+
if (!compare_array(left_syms, right_syms))
|
|
1787
|
+
return false;
|
|
1788
|
+
for (let key of left_syms) {
|
|
1789
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
1780
1790
|
return false;
|
|
1781
1791
|
}
|
|
1782
1792
|
return true;
|
|
@@ -3596,8 +3606,9 @@ var $;
|
|
|
3596
3606
|
$mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
3597
3607
|
$mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
3598
3608
|
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
3599
|
-
$
|
|
3609
|
+
$mol_assert_not($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
3600
3610
|
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
3611
|
+
$mol_assert_ok($mol_compare_deep(Object.create(null), Object.create(null)));
|
|
3601
3612
|
},
|
|
3602
3613
|
'Array'() {
|
|
3603
3614
|
$mol_assert_ok($mol_compare_deep([], []));
|
|
@@ -3612,6 +3623,11 @@ var $;
|
|
|
3612
3623
|
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
3613
3624
|
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
3614
3625
|
},
|
|
3626
|
+
'POJO with symbols'() {
|
|
3627
|
+
const sym = Symbol();
|
|
3628
|
+
$mol_assert_ok($mol_compare_deep({ [sym]: true }, { [sym]: true }));
|
|
3629
|
+
$mol_assert_not($mol_compare_deep({ [Symbol()]: true }, { [Symbol()]: true }));
|
|
3630
|
+
},
|
|
3615
3631
|
'same POJOs with cyclic reference'() {
|
|
3616
3632
|
const a = { foo: {} };
|
|
3617
3633
|
a['self'] = a;
|