mol_wire_lib 1.0.526 → 1.0.528
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
|
@@ -796,7 +796,9 @@ var $;
|
|
|
796
796
|
}
|
|
797
797
|
let result;
|
|
798
798
|
try {
|
|
799
|
-
if (
|
|
799
|
+
if (!left_proto)
|
|
800
|
+
result = compare_pojo(left, right);
|
|
801
|
+
else if (!Reflect.getPrototypeOf(left_proto))
|
|
800
802
|
result = compare_pojo(left, right);
|
|
801
803
|
else if (Array.isArray(left))
|
|
802
804
|
result = compare_array(left, right);
|
|
@@ -864,10 +866,18 @@ var $;
|
|
|
864
866
|
function compare_pojo(left, right) {
|
|
865
867
|
const left_keys = Object.getOwnPropertyNames(left);
|
|
866
868
|
const right_keys = Object.getOwnPropertyNames(right);
|
|
867
|
-
if (left_keys
|
|
869
|
+
if (!compare_array(left_keys, right_keys))
|
|
868
870
|
return false;
|
|
869
871
|
for (let key of left_keys) {
|
|
870
|
-
if (!$mol_compare_deep(left[key],
|
|
872
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
873
|
+
return false;
|
|
874
|
+
}
|
|
875
|
+
const left_syms = Object.getOwnPropertySymbols(left);
|
|
876
|
+
const right_syms = Object.getOwnPropertySymbols(right);
|
|
877
|
+
if (!compare_array(left_syms, right_syms))
|
|
878
|
+
return false;
|
|
879
|
+
for (let key of left_syms) {
|
|
880
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
871
881
|
return false;
|
|
872
882
|
}
|
|
873
883
|
return true;
|
|
@@ -2846,8 +2856,9 @@ var $;
|
|
|
2846
2856
|
$mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
2847
2857
|
$mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
2848
2858
|
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
2849
|
-
$
|
|
2859
|
+
$mol_assert_not($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
2850
2860
|
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
2861
|
+
$mol_assert_ok($mol_compare_deep(Object.create(null), Object.create(null)));
|
|
2851
2862
|
},
|
|
2852
2863
|
'Array'() {
|
|
2853
2864
|
$mol_assert_ok($mol_compare_deep([], []));
|
|
@@ -2862,6 +2873,11 @@ var $;
|
|
|
2862
2873
|
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
2863
2874
|
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
2864
2875
|
},
|
|
2876
|
+
'POJO with symbols'() {
|
|
2877
|
+
const sym = Symbol();
|
|
2878
|
+
$mol_assert_ok($mol_compare_deep({ [sym]: true }, { [sym]: true }));
|
|
2879
|
+
$mol_assert_not($mol_compare_deep({ [Symbol()]: true }, { [Symbol()]: true }));
|
|
2880
|
+
},
|
|
2865
2881
|
'same POJOs with cyclic reference'() {
|
|
2866
2882
|
const a = { foo: {} };
|
|
2867
2883
|
a['self'] = a;
|