mol_regexp 0.0.696 → 0.0.698
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 +22 -6
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.test.js +22 -6
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -972,7 +972,9 @@ var $;
|
|
|
972
972
|
}
|
|
973
973
|
let result;
|
|
974
974
|
try {
|
|
975
|
-
if (
|
|
975
|
+
if (!left_proto)
|
|
976
|
+
result = compare_pojo(left, right);
|
|
977
|
+
else if (!Reflect.getPrototypeOf(left_proto))
|
|
976
978
|
result = compare_pojo(left, right);
|
|
977
979
|
else if (Array.isArray(left))
|
|
978
980
|
result = compare_array(left, right);
|
|
@@ -1040,10 +1042,18 @@ var $;
|
|
|
1040
1042
|
function compare_pojo(left, right) {
|
|
1041
1043
|
const left_keys = Object.getOwnPropertyNames(left);
|
|
1042
1044
|
const right_keys = Object.getOwnPropertyNames(right);
|
|
1043
|
-
if (left_keys
|
|
1045
|
+
if (!compare_array(left_keys, right_keys))
|
|
1044
1046
|
return false;
|
|
1045
1047
|
for (let key of left_keys) {
|
|
1046
|
-
if (!$mol_compare_deep(left[key],
|
|
1048
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
1049
|
+
return false;
|
|
1050
|
+
}
|
|
1051
|
+
const left_syms = Object.getOwnPropertySymbols(left);
|
|
1052
|
+
const right_syms = Object.getOwnPropertySymbols(right);
|
|
1053
|
+
if (!compare_array(left_syms, right_syms))
|
|
1054
|
+
return false;
|
|
1055
|
+
for (let key of left_syms) {
|
|
1056
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
1047
1057
|
return false;
|
|
1048
1058
|
}
|
|
1049
1059
|
return true;
|
|
@@ -1076,8 +1086,9 @@ var $;
|
|
|
1076
1086
|
$mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
1077
1087
|
$mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
1078
1088
|
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
1079
|
-
$
|
|
1089
|
+
$mol_assert_not($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
1080
1090
|
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
1091
|
+
$mol_assert_ok($mol_compare_deep(Object.create(null), Object.create(null)));
|
|
1081
1092
|
},
|
|
1082
1093
|
'Array'() {
|
|
1083
1094
|
$mol_assert_ok($mol_compare_deep([], []));
|
|
@@ -1092,6 +1103,11 @@ var $;
|
|
|
1092
1103
|
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
1093
1104
|
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
1094
1105
|
},
|
|
1106
|
+
'POJO with symbols'() {
|
|
1107
|
+
const sym = Symbol();
|
|
1108
|
+
$mol_assert_ok($mol_compare_deep({ [sym]: true }, { [sym]: true }));
|
|
1109
|
+
$mol_assert_not($mol_compare_deep({ [Symbol()]: true }, { [Symbol()]: true }));
|
|
1110
|
+
},
|
|
1095
1111
|
'same POJOs with cyclic reference'() {
|
|
1096
1112
|
const a = { foo: {} };
|
|
1097
1113
|
a['self'] = a;
|
|
@@ -2404,12 +2420,12 @@ var $;
|
|
|
2404
2420
|
$mol_assert_equal('foo..bar@example.org'.match(mail), null);
|
|
2405
2421
|
$mol_assert_equal('foo..bar"@example.org'.match(mail), null);
|
|
2406
2422
|
$mol_assert_like([...'foo.bar@example.org'.matchAll(mail)][0].groups, {
|
|
2407
|
-
domain: "example.org",
|
|
2408
2423
|
dot_atom: "foo.bar",
|
|
2424
|
+
quoted_name: "",
|
|
2409
2425
|
name: "",
|
|
2410
2426
|
name_letter: "",
|
|
2411
|
-
quoted_name: "",
|
|
2412
2427
|
quoted_pair: "",
|
|
2428
|
+
domain: "example.org",
|
|
2413
2429
|
});
|
|
2414
2430
|
$mol_assert_like([...'"foo..bar"@example.org'.matchAll(mail)][0].groups, {
|
|
2415
2431
|
dot_atom: "",
|