mol_data_all 1.1.151 → 1.1.152
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 +46 -113
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.test.js +46 -113
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -792,23 +792,15 @@ var $;
|
|
|
792
792
|
$.$mol_assert_ok($.$mol_compare_deep(1, 1));
|
|
793
793
|
$.$mol_assert_ok($.$mol_compare_deep(Number.NaN, Number.NaN));
|
|
794
794
|
$.$mol_assert_not($.$mol_compare_deep(1, 2));
|
|
795
|
+
$.$mol_assert_not($.$mol_compare_deep(Object(1), Object(1)));
|
|
795
796
|
},
|
|
796
|
-
'
|
|
797
|
-
$.$mol_assert_ok($.$mol_compare_deep(Object(1), Object(1)));
|
|
798
|
-
$.$mol_assert_ok($.$mol_compare_deep(Object(Number.NaN), Object(Number.NaN)));
|
|
799
|
-
$.$mol_assert_not($.$mol_compare_deep(Object(1), Object(2)));
|
|
800
|
-
},
|
|
801
|
-
'empty POJOs'() {
|
|
797
|
+
'POJO'() {
|
|
802
798
|
$.$mol_assert_ok($.$mol_compare_deep({}, {}));
|
|
803
|
-
},
|
|
804
|
-
'different POJOs'() {
|
|
805
799
|
$.$mol_assert_not($.$mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
806
|
-
},
|
|
807
|
-
'different POJOs with same keys but different values'() {
|
|
808
800
|
$.$mol_assert_not($.$mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
809
|
-
},
|
|
810
|
-
'different POJOs with different keys but same values'() {
|
|
811
801
|
$.$mol_assert_not($.$mol_compare_deep({}, { a: undefined }));
|
|
802
|
+
$.$mol_assert_ok($.$mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
803
|
+
$.$mol_assert_ok($.$mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
812
804
|
},
|
|
813
805
|
'Array'() {
|
|
814
806
|
$.$mol_assert_ok($.$mol_compare_deep([], []));
|
|
@@ -816,17 +808,12 @@ var $;
|
|
|
816
808
|
$.$mol_assert_not($.$mol_compare_deep([1, 2], [1, 3]));
|
|
817
809
|
$.$mol_assert_not($.$mol_compare_deep([1, 2,], [1, 3, undefined]));
|
|
818
810
|
},
|
|
819
|
-
'
|
|
820
|
-
|
|
821
|
-
},
|
|
822
|
-
'different classes with same values'() {
|
|
823
|
-
class Obj {
|
|
824
|
-
foo = 1;
|
|
811
|
+
'Non POJO are different'() {
|
|
812
|
+
class Thing extends Object {
|
|
825
813
|
}
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
$.$mol_assert_not($.$mol_compare_deep(a, b));
|
|
814
|
+
$.$mol_assert_not($.$mol_compare_deep(new Thing, new Thing));
|
|
815
|
+
$.$mol_assert_not($.$mol_compare_deep(() => 1, () => 1));
|
|
816
|
+
$.$mol_assert_not($.$mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
830
817
|
},
|
|
831
818
|
'same POJOs with cyclic reference'() {
|
|
832
819
|
const a = { foo: {} };
|
|
@@ -835,41 +822,6 @@ var $;
|
|
|
835
822
|
b['self'] = b;
|
|
836
823
|
$.$mol_assert_ok($.$mol_compare_deep(a, b));
|
|
837
824
|
},
|
|
838
|
-
'empty Element'() {
|
|
839
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", null), $.$mol_jsx("div", null)));
|
|
840
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null), $.$mol_jsx("span", null)));
|
|
841
|
-
},
|
|
842
|
-
'Element with attributes'() {
|
|
843
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", { dir: "rtl" })));
|
|
844
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", null)));
|
|
845
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { dir: "rtl" }), $.$mol_jsx("div", { dir: "ltr" })));
|
|
846
|
-
},
|
|
847
|
-
'Element with styles'() {
|
|
848
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: { color: 'red' } })));
|
|
849
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: {} })));
|
|
850
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { style: { color: 'red' } }), $.$mol_jsx("div", { style: { color: 'blue' } })));
|
|
851
|
-
},
|
|
852
|
-
'Element with content'() {
|
|
853
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
854
|
-
"foo",
|
|
855
|
-
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
856
|
-
"foo",
|
|
857
|
-
$.$mol_jsx("br", null))));
|
|
858
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
859
|
-
"foo",
|
|
860
|
-
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
861
|
-
"bar",
|
|
862
|
-
$.$mol_jsx("br", null))));
|
|
863
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", null,
|
|
864
|
-
"foo",
|
|
865
|
-
$.$mol_jsx("br", null)), $.$mol_jsx("div", null,
|
|
866
|
-
"foo",
|
|
867
|
-
$.$mol_jsx("hr", null))));
|
|
868
|
-
},
|
|
869
|
-
'Element with handlers'() {
|
|
870
|
-
$.$mol_assert_ok($.$mol_compare_deep($.$mol_jsx("div", { onclick: () => 1 }), $.$mol_jsx("div", { onclick: () => 1 })));
|
|
871
|
-
$.$mol_assert_not($.$mol_compare_deep($.$mol_jsx("div", { onclick: () => 1 }), $.$mol_jsx("div", { onclick: () => 2 })));
|
|
872
|
-
},
|
|
873
825
|
'Date'() {
|
|
874
826
|
$.$mol_assert_ok($.$mol_compare_deep(new Date(12345), new Date(12345)));
|
|
875
827
|
$.$mol_assert_not($.$mol_compare_deep(new Date(12345), new Date(12346)));
|
|
@@ -901,94 +853,74 @@ var $;
|
|
|
901
853
|
"use strict";
|
|
902
854
|
var $;
|
|
903
855
|
(function ($) {
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
function $mol_compare_deep(a, b) {
|
|
908
|
-
if (Object.is(a, b))
|
|
856
|
+
let cache = new WeakMap();
|
|
857
|
+
function $mol_compare_deep(left, right) {
|
|
858
|
+
if (Object.is(left, right))
|
|
909
859
|
return true;
|
|
910
|
-
|
|
911
|
-
const b_type = typeof b;
|
|
912
|
-
if (a_type !== b_type)
|
|
860
|
+
if (left === null)
|
|
913
861
|
return false;
|
|
914
|
-
if (
|
|
915
|
-
return a['toString']() === b['toString']();
|
|
916
|
-
if (a_type !== 'object')
|
|
862
|
+
if (right === null)
|
|
917
863
|
return false;
|
|
918
|
-
if (
|
|
864
|
+
if (typeof left !== 'object')
|
|
919
865
|
return false;
|
|
920
|
-
if (
|
|
866
|
+
if (typeof right !== 'object')
|
|
921
867
|
return false;
|
|
922
|
-
if (
|
|
868
|
+
if (left['constructor'] !== right['constructor'])
|
|
923
869
|
return false;
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
}
|
|
930
|
-
if (!cache)
|
|
931
|
-
cache = new WeakMap;
|
|
932
|
-
let a_cache = cache.get(a);
|
|
933
|
-
if (a_cache) {
|
|
934
|
-
const b_cache = a_cache.get(b);
|
|
935
|
-
if (typeof b_cache === 'boolean')
|
|
936
|
-
return b_cache;
|
|
870
|
+
let left_cache = cache.get(left);
|
|
871
|
+
if (left_cache) {
|
|
872
|
+
const right_cache = left_cache.get(right);
|
|
873
|
+
if (typeof right_cache === 'boolean')
|
|
874
|
+
return right_cache;
|
|
937
875
|
}
|
|
938
876
|
else {
|
|
939
|
-
|
|
940
|
-
cache.set(
|
|
877
|
+
left_cache = new WeakMap();
|
|
878
|
+
cache.set(left, left_cache);
|
|
879
|
+
left_cache.set(right, true);
|
|
941
880
|
}
|
|
942
|
-
|
|
943
|
-
|
|
881
|
+
if (left instanceof RegExp)
|
|
882
|
+
return left.toString() === right['toString']();
|
|
883
|
+
if (left instanceof Date)
|
|
884
|
+
return Object.is(left.valueOf(), right['valueOf']());
|
|
944
885
|
let result;
|
|
945
886
|
try {
|
|
946
|
-
if (Symbol.iterator in
|
|
947
|
-
const
|
|
948
|
-
const
|
|
887
|
+
if (Symbol.iterator in left) {
|
|
888
|
+
const left_iter = left[Symbol.iterator]();
|
|
889
|
+
const right_iter = right[Symbol.iterator]();
|
|
949
890
|
while (true) {
|
|
950
|
-
const
|
|
951
|
-
const
|
|
952
|
-
if (
|
|
891
|
+
const left_next = left_iter.next();
|
|
892
|
+
const right_next = right_iter.next();
|
|
893
|
+
if (left_next.done !== right_next.done)
|
|
953
894
|
return result = false;
|
|
954
|
-
if (
|
|
895
|
+
if (left_next.done)
|
|
955
896
|
break;
|
|
956
|
-
if (!$mol_compare_deep(
|
|
897
|
+
if (!$mol_compare_deep(left_next.value, right_next.value))
|
|
957
898
|
return result = false;
|
|
958
899
|
}
|
|
959
900
|
return result = true;
|
|
960
901
|
}
|
|
902
|
+
if (left['constructor'] !== ({}).constructor)
|
|
903
|
+
return result = false;
|
|
961
904
|
let count = 0;
|
|
962
|
-
for (let key in
|
|
905
|
+
for (let key in left) {
|
|
963
906
|
try {
|
|
964
|
-
if (!$mol_compare_deep(
|
|
907
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
965
908
|
return result = false;
|
|
966
909
|
}
|
|
967
910
|
catch (error) {
|
|
968
|
-
$.$mol_fail_hidden(new $.$mol_error_mix(`Failed ${JSON.stringify(key)} fields comparison of ${
|
|
911
|
+
$.$mol_fail_hidden(new $.$mol_error_mix(`Failed ${JSON.stringify(key)} fields comparison of ${left} and ${right}`, error));
|
|
969
912
|
}
|
|
970
913
|
++count;
|
|
971
914
|
}
|
|
972
|
-
for (let key in
|
|
915
|
+
for (let key in right) {
|
|
973
916
|
--count;
|
|
974
917
|
if (count < 0)
|
|
975
918
|
return result = false;
|
|
976
919
|
}
|
|
977
|
-
if (a instanceof Number || a instanceof String || a instanceof Symbol || a instanceof Boolean || a instanceof Date) {
|
|
978
|
-
if (!Object.is(a['valueOf'](), b['valueOf']()))
|
|
979
|
-
return result = false;
|
|
980
|
-
}
|
|
981
920
|
return result = true;
|
|
982
921
|
}
|
|
983
922
|
finally {
|
|
984
|
-
|
|
985
|
-
b_stack.pop();
|
|
986
|
-
if (a_stack.length === 0) {
|
|
987
|
-
cache = null;
|
|
988
|
-
}
|
|
989
|
-
else {
|
|
990
|
-
a_cache.set(b, result);
|
|
991
|
-
}
|
|
923
|
+
left_cache.set(right, result);
|
|
992
924
|
}
|
|
993
925
|
}
|
|
994
926
|
$.$mol_compare_deep = $mol_compare_deep;
|
|
@@ -1788,7 +1720,8 @@ var $;
|
|
|
1788
1720
|
}
|
|
1789
1721
|
}
|
|
1790
1722
|
const boxify = $.$mol_data_pipe((input) => input.toString(), Box);
|
|
1791
|
-
$.$
|
|
1723
|
+
$.$mol_assert_ok(boxify(5) instanceof Box);
|
|
1724
|
+
$.$mol_assert_like(boxify(5).value, '5');
|
|
1792
1725
|
},
|
|
1793
1726
|
});
|
|
1794
1727
|
})($ || ($ = {}));
|