mol_compare_deep 0.0.721 → 0.0.723
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.audit.js +1 -1
- package/node.deps.json +1 -1
- package/node.test.js +41 -65
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.audit.js +1 -1
- package/web.deps.json +1 -1
- package/web.test.js +32 -56
- package/web.test.js.map +1 -1
package/node.audit.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
console.info(
|
|
1
|
+
console.info( '%c ▫ $mol_build ▫ Audit passed', 'color:forestgreen; font-weight:bolder' )
|
package/node.deps.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"files":["mam.ts","LICENSE","README.md","yarn.lock","mam.jam.js","tsfmt.json","package.json","tsconfig.json","lang.lang.tree","meta.lang.tree","sandbox.config.json","mol/CNAME","mol/LICENSE","mol/readme.md","mol/index.html","mol/mol.meta.tree","mol/CONTRIBUTING.md","mol/CODE_OF_CONDUCT.md","mol/compare/deep/deep.ts","mol/compare/deep/README.md"],"mods":{},"deps_in":{"mol/compare":{"mol/compare/deep":-9007199254740991},"mol":{"mol/compare":-9007199254740991},"":{"mol":-9007199254740991}},"deps_out":{"mol/compare/deep":{"mol/compare":-9007199254740991},"mol/compare":{"mol":-9007199254740991},"mol":{"":-9007199254740991}},"sloc":{"ts":120,"LICENSE":113,"md":496,"lock":
|
|
1
|
+
{"files":["mam.ts","LICENSE","README.md","yarn.lock","mam.jam.js","tsfmt.json","package.json","tsconfig.json","lang.lang.tree","meta.lang.tree","sandbox.config.json","mol/CNAME","mol/LICENSE","mol/readme.md","mol/index.html","mol/mol.meta.tree","mol/CONTRIBUTING.md","mol/CODE_OF_CONDUCT.md","mol/compare/deep/deep.ts","mol/compare/deep/README.md"],"mods":{},"deps_in":{"mol/compare":{"mol/compare/deep":-9007199254740991},"mol":{"mol/compare":-9007199254740991},"":{"mol":-9007199254740991}},"deps_out":{"mol/compare/deep":{"mol/compare":-9007199254740991},"mol/compare":{"mol":-9007199254740991},"mol":{"":-9007199254740991}},"sloc":{"ts":120,"LICENSE":113,"md":496,"lock":944,"js":9,"json":92,"tree":41,"CNAME":1,"html":1},"deps":{"mol/compare/deep":{"..":-9007199254740991,"/mol/compare/deep/cache":-1,"/mol/compare/deep":-1,"/mol/compare/deep/cache/get":-2,"/mol/compare/deep/cache/set":-3},"mol/compare":{"..":-9007199254740991},"mol":{"..":-9007199254740991},"":{}}}
|
package/node.test.js
CHANGED
|
@@ -415,17 +415,6 @@ var $;
|
|
|
415
415
|
;
|
|
416
416
|
"use strict";
|
|
417
417
|
var $;
|
|
418
|
-
(function ($) {
|
|
419
|
-
function $mol_dom_serialize(node) {
|
|
420
|
-
const serializer = new $mol_dom_context.XMLSerializer;
|
|
421
|
-
return serializer.serializeToString(node);
|
|
422
|
-
}
|
|
423
|
-
$.$mol_dom_serialize = $mol_dom_serialize;
|
|
424
|
-
})($ || ($ = {}));
|
|
425
|
-
//mol/dom/serialize/serialize.ts
|
|
426
|
-
;
|
|
427
|
-
"use strict";
|
|
428
|
-
var $;
|
|
429
418
|
(function ($) {
|
|
430
419
|
function $mol_assert_ok(value) {
|
|
431
420
|
if (value)
|
|
@@ -446,14 +435,12 @@ var $;
|
|
|
446
435
|
handler();
|
|
447
436
|
}
|
|
448
437
|
catch (error) {
|
|
449
|
-
if (!ErrorRight)
|
|
450
|
-
return error;
|
|
451
438
|
$.$mol_fail = fail;
|
|
452
439
|
if (typeof ErrorRight === 'string') {
|
|
453
440
|
$mol_assert_equal(error.message, ErrorRight);
|
|
454
441
|
}
|
|
455
442
|
else {
|
|
456
|
-
$
|
|
443
|
+
$mol_assert_equal(error instanceof ErrorRight, true);
|
|
457
444
|
}
|
|
458
445
|
return error;
|
|
459
446
|
}
|
|
@@ -463,58 +450,47 @@ var $;
|
|
|
463
450
|
$mol_fail(new Error('Not failed'));
|
|
464
451
|
}
|
|
465
452
|
$.$mol_assert_fail = $mol_assert_fail;
|
|
466
|
-
function $
|
|
467
|
-
|
|
468
|
-
for (let j = 0; j < args.length; ++j) {
|
|
469
|
-
if (i === j)
|
|
470
|
-
continue;
|
|
471
|
-
if (Number.isNaN(args[i]) && Number.isNaN(args[j]))
|
|
472
|
-
continue;
|
|
473
|
-
if (args[i] !== args[j])
|
|
474
|
-
$mol_fail(new Error(`Not equal (${i + 1}:${j + 1})\n${args[i]}\n${args[j]}`));
|
|
475
|
-
}
|
|
476
|
-
}
|
|
453
|
+
function $mol_assert_like(...args) {
|
|
454
|
+
$mol_assert_equal(...args);
|
|
477
455
|
}
|
|
478
|
-
$.$
|
|
456
|
+
$.$mol_assert_like = $mol_assert_like;
|
|
479
457
|
function $mol_assert_unique(...args) {
|
|
480
458
|
for (let i = 0; i < args.length; ++i) {
|
|
481
459
|
for (let j = 0; j < args.length; ++j) {
|
|
482
460
|
if (i === j)
|
|
483
461
|
continue;
|
|
484
|
-
if (
|
|
485
|
-
|
|
486
|
-
}
|
|
462
|
+
if (!$mol_compare_deep(args[i], args[j]))
|
|
463
|
+
continue;
|
|
464
|
+
$mol_fail(new Error(`args[${i}] = args[${j}] = ${args[i]}`));
|
|
487
465
|
}
|
|
488
466
|
}
|
|
489
467
|
}
|
|
490
468
|
$.$mol_assert_unique = $mol_assert_unique;
|
|
491
|
-
function $
|
|
492
|
-
for (let
|
|
493
|
-
if (
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
return val;
|
|
499
|
-
if ('outerHTML' in val)
|
|
500
|
-
return val.outerHTML;
|
|
501
|
-
try {
|
|
502
|
-
return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
|
|
503
|
-
}
|
|
504
|
-
catch (error) {
|
|
505
|
-
console.error(error);
|
|
506
|
-
return val;
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
return $mol_fail(new Error(`Not like (1:${+index + 2})\n${print(head)}\n---\n${print(value)}`));
|
|
510
|
-
}
|
|
469
|
+
function $mol_assert_equal(...args) {
|
|
470
|
+
for (let i = 1; i < args.length; ++i) {
|
|
471
|
+
if ($mol_compare_deep(args[0], args[i]))
|
|
472
|
+
continue;
|
|
473
|
+
if (args[0] instanceof $mol_dom_context.Element && args[i] instanceof $mol_dom_context.Element && args[0].outerHTML === args[i].outerHTML)
|
|
474
|
+
continue;
|
|
475
|
+
return $mol_fail(new Error(`args[0] ≠ args[${i}]\n${print(args[0])}\n---\n${print(args[i])}`));
|
|
511
476
|
}
|
|
512
477
|
}
|
|
513
|
-
$.$
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
478
|
+
$.$mol_assert_equal = $mol_assert_equal;
|
|
479
|
+
const print = (val) => {
|
|
480
|
+
if (!val)
|
|
481
|
+
return val;
|
|
482
|
+
if (typeof val !== 'object')
|
|
483
|
+
return val;
|
|
484
|
+
if ('outerHTML' in val)
|
|
485
|
+
return val.outerHTML;
|
|
486
|
+
try {
|
|
487
|
+
return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
|
|
488
|
+
}
|
|
489
|
+
catch (error) {
|
|
490
|
+
console.error(error);
|
|
491
|
+
return val;
|
|
492
|
+
}
|
|
493
|
+
};
|
|
518
494
|
})($ || ($ = {}));
|
|
519
495
|
//mol/assert/assert.ts
|
|
520
496
|
;
|
|
@@ -535,10 +511,10 @@ var $;
|
|
|
535
511
|
$mol_assert_equal(2, 2, 2);
|
|
536
512
|
},
|
|
537
513
|
'two must be unique'() {
|
|
538
|
-
$mol_assert_unique([
|
|
514
|
+
$mol_assert_unique([2], [3]);
|
|
539
515
|
},
|
|
540
516
|
'three must be unique'() {
|
|
541
|
-
$mol_assert_unique([
|
|
517
|
+
$mol_assert_unique([1], [2], [3]);
|
|
542
518
|
},
|
|
543
519
|
'two must be alike'() {
|
|
544
520
|
$mol_assert_like([3], [3]);
|
|
@@ -997,7 +973,7 @@ var $;
|
|
|
997
973
|
};
|
|
998
974
|
}
|
|
999
975
|
error(message, Class = Error) {
|
|
1000
|
-
return new Class(`${message}${this}`);
|
|
976
|
+
return new Class(`${message} (${this})`);
|
|
1001
977
|
}
|
|
1002
978
|
span(row, col, length) {
|
|
1003
979
|
return new $mol_span(this.uri, this.source, row, col, length);
|
|
@@ -1012,11 +988,11 @@ var $;
|
|
|
1012
988
|
if (end < 0)
|
|
1013
989
|
end += len;
|
|
1014
990
|
if (begin < 0 || begin > len)
|
|
1015
|
-
this.$.$mol_fail(`Begin value '${begin}' out of range
|
|
991
|
+
this.$.$mol_fail(this.error(`Begin value '${begin}' out of range`, RangeError));
|
|
1016
992
|
if (end < 0 || end > len)
|
|
1017
|
-
this.$.$mol_fail(`End value '${end}' out of range
|
|
993
|
+
this.$.$mol_fail(this.error(`End value '${end}' out of range`, RangeError));
|
|
1018
994
|
if (end < begin)
|
|
1019
|
-
this.$.$mol_fail(`End value '${end}' can't be less than begin value
|
|
995
|
+
this.$.$mol_fail(this.error(`End value '${end}' can't be less than begin value`, RangeError));
|
|
1020
996
|
return this.span(this.row, this.col + begin, end - begin);
|
|
1021
997
|
}
|
|
1022
998
|
}
|
|
@@ -1063,14 +1039,14 @@ var $;
|
|
|
1063
1039
|
},
|
|
1064
1040
|
'slice span - out of range'($) {
|
|
1065
1041
|
const span = new $mol_span('test.ts', '', 1, 3, 5);
|
|
1066
|
-
$mol_assert_fail(() => span.slice(-1, 3));
|
|
1067
|
-
$mol_assert_fail(() => span.slice(1, 6));
|
|
1068
|
-
$mol_assert_fail(() => span.slice(1, 10));
|
|
1042
|
+
$mol_assert_fail(() => span.slice(-1, 3), `End value '3' can't be less than begin value (test.ts#1:3/5)`);
|
|
1043
|
+
$mol_assert_fail(() => span.slice(1, 6), `End value '6' out of range (test.ts#1:3/5)`);
|
|
1044
|
+
$mol_assert_fail(() => span.slice(1, 10), `End value '10' out of range (test.ts#1:3/5)`);
|
|
1069
1045
|
},
|
|
1070
1046
|
'error handling'($) {
|
|
1071
1047
|
const span = new $mol_span('test.ts', '', 1, 3, 4);
|
|
1072
|
-
const error = span.error('Some error
|
|
1073
|
-
$mol_assert_equal(error.message, 'Some error
|
|
1048
|
+
const error = span.error('Some error');
|
|
1049
|
+
$mol_assert_equal(error.message, 'Some error (test.ts#1:3/4)');
|
|
1074
1050
|
}
|
|
1075
1051
|
});
|
|
1076
1052
|
})($ || ($ = {}));
|