mol_time_all 1.1.522 → 1.1.523
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 +20 -4
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.test.js +20 -4
- package/web.test.js.map +1 -1
package/node.test.js
CHANGED
|
@@ -1296,7 +1296,9 @@ var $;
|
|
|
1296
1296
|
}
|
|
1297
1297
|
let result;
|
|
1298
1298
|
try {
|
|
1299
|
-
if (
|
|
1299
|
+
if (!left_proto)
|
|
1300
|
+
result = compare_pojo(left, right);
|
|
1301
|
+
else if (!Reflect.getPrototypeOf(left_proto))
|
|
1300
1302
|
result = compare_pojo(left, right);
|
|
1301
1303
|
else if (Array.isArray(left))
|
|
1302
1304
|
result = compare_array(left, right);
|
|
@@ -1364,10 +1366,18 @@ var $;
|
|
|
1364
1366
|
function compare_pojo(left, right) {
|
|
1365
1367
|
const left_keys = Object.getOwnPropertyNames(left);
|
|
1366
1368
|
const right_keys = Object.getOwnPropertyNames(right);
|
|
1367
|
-
if (left_keys
|
|
1369
|
+
if (!compare_array(left_keys, right_keys))
|
|
1368
1370
|
return false;
|
|
1369
1371
|
for (let key of left_keys) {
|
|
1370
|
-
if (!$mol_compare_deep(left[key],
|
|
1372
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
1373
|
+
return false;
|
|
1374
|
+
}
|
|
1375
|
+
const left_syms = Object.getOwnPropertySymbols(left);
|
|
1376
|
+
const right_syms = Object.getOwnPropertySymbols(right);
|
|
1377
|
+
if (!compare_array(left_syms, right_syms))
|
|
1378
|
+
return false;
|
|
1379
|
+
for (let key of left_syms) {
|
|
1380
|
+
if (!$mol_compare_deep(left[key], right[key]))
|
|
1371
1381
|
return false;
|
|
1372
1382
|
}
|
|
1373
1383
|
return true;
|
|
@@ -1400,8 +1410,9 @@ var $;
|
|
|
1400
1410
|
$mol_assert_not($mol_compare_deep({ a: 1 }, { b: 2 }));
|
|
1401
1411
|
$mol_assert_not($mol_compare_deep({ a: 1 }, { a: 2 }));
|
|
1402
1412
|
$mol_assert_not($mol_compare_deep({}, { a: undefined }));
|
|
1403
|
-
$
|
|
1413
|
+
$mol_assert_not($mol_compare_deep({ a: 1, b: 2 }, { b: 2, a: 1 }));
|
|
1404
1414
|
$mol_assert_ok($mol_compare_deep({ a: { b: 1 } }, { a: { b: 1 } }));
|
|
1415
|
+
$mol_assert_ok($mol_compare_deep(Object.create(null), Object.create(null)));
|
|
1405
1416
|
},
|
|
1406
1417
|
'Array'() {
|
|
1407
1418
|
$mol_assert_ok($mol_compare_deep([], []));
|
|
@@ -1416,6 +1427,11 @@ var $;
|
|
|
1416
1427
|
$mol_assert_not($mol_compare_deep(() => 1, () => 1));
|
|
1417
1428
|
$mol_assert_not($mol_compare_deep(new RangeError('Test error'), new RangeError('Test error')));
|
|
1418
1429
|
},
|
|
1430
|
+
'POJO with symbols'() {
|
|
1431
|
+
const sym = Symbol();
|
|
1432
|
+
$mol_assert_ok($mol_compare_deep({ [sym]: true }, { [sym]: true }));
|
|
1433
|
+
$mol_assert_not($mol_compare_deep({ [Symbol()]: true }, { [Symbol()]: true }));
|
|
1434
|
+
},
|
|
1419
1435
|
'same POJOs with cyclic reference'() {
|
|
1420
1436
|
const a = { foo: {} };
|
|
1421
1437
|
a['self'] = a;
|