mol_text_distance 0.0.625 → 0.0.627
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/text/profile/profile.ts","mol/text/profile/distance/distance.ts","mol/text/distance/readme.md","mol/text/distance/distance.ts"],"mods":{},"deps_in":{"mol/text":{"mol/text/distance":-9007199254740991,"mol/text/profile":-9007199254740991},"mol":{"mol/text":-9007199254740991},"":{"mol":-9007199254740991},"mol/text/profile/distance":{"mol/text/distance":-2},"mol/text/profile":{"mol/text/profile/distance":-9007199254740991,"mol/text/distance":-3}},"deps_out":{"mol/text/distance":{"mol/text":-9007199254740991,"mol/text/profile/distance":-2,"mol/text/profile":-3},"mol/text":{"mol":-9007199254740991},"mol":{"":-9007199254740991},"mol/text/profile/distance":{"mol/text/profile":-9007199254740991},"mol/text/profile":{"mol/text":-9007199254740991}},"sloc":{"ts":55,"LICENSE":113,"md":503,"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/text/profile/profile.ts","mol/text/profile/distance/distance.ts","mol/text/distance/readme.md","mol/text/distance/distance.ts"],"mods":{},"deps_in":{"mol/text":{"mol/text/distance":-9007199254740991,"mol/text/profile":-9007199254740991},"mol":{"mol/text":-9007199254740991},"":{"mol":-9007199254740991},"mol/text/profile/distance":{"mol/text/distance":-2},"mol/text/profile":{"mol/text/profile/distance":-9007199254740991,"mol/text/distance":-3}},"deps_out":{"mol/text/distance":{"mol/text":-9007199254740991,"mol/text/profile/distance":-2,"mol/text/profile":-3},"mol/text":{"mol":-9007199254740991},"mol":{"":-9007199254740991},"mol/text/profile/distance":{"mol/text/profile":-9007199254740991},"mol/text/profile":{"mol/text":-9007199254740991}},"sloc":{"ts":55,"LICENSE":113,"md":503,"lock":944,"js":9,"json":92,"tree":41,"CNAME":1,"html":1},"deps":{"mol/text/distance":{"..":-9007199254740991,"/mol/text/distance":-1,"/mol/text/profile/distance":-2,"/mol/text/profile":-3},"mol/text":{"..":-9007199254740991},"mol":{"..":-9007199254740991},"":{},"mol/text/profile/distance":{"..":-9007199254740991,"/mol/text/profile/distance":-1},"mol/text/profile":{"..":-9007199254740991,"/mol/text/profile":-1}}}
|
package/node.test.js
CHANGED
|
@@ -1238,17 +1238,6 @@ var $;
|
|
|
1238
1238
|
;
|
|
1239
1239
|
"use strict";
|
|
1240
1240
|
var $;
|
|
1241
|
-
(function ($) {
|
|
1242
|
-
function $mol_dom_serialize(node) {
|
|
1243
|
-
const serializer = new $mol_dom_context.XMLSerializer;
|
|
1244
|
-
return serializer.serializeToString(node);
|
|
1245
|
-
}
|
|
1246
|
-
$.$mol_dom_serialize = $mol_dom_serialize;
|
|
1247
|
-
})($ || ($ = {}));
|
|
1248
|
-
//mol/dom/serialize/serialize.ts
|
|
1249
|
-
;
|
|
1250
|
-
"use strict";
|
|
1251
|
-
var $;
|
|
1252
1241
|
(function ($) {
|
|
1253
1242
|
function $mol_assert_ok(value) {
|
|
1254
1243
|
if (value)
|
|
@@ -1269,14 +1258,12 @@ var $;
|
|
|
1269
1258
|
handler();
|
|
1270
1259
|
}
|
|
1271
1260
|
catch (error) {
|
|
1272
|
-
if (!ErrorRight)
|
|
1273
|
-
return error;
|
|
1274
1261
|
$.$mol_fail = fail;
|
|
1275
1262
|
if (typeof ErrorRight === 'string') {
|
|
1276
1263
|
$mol_assert_equal(error.message, ErrorRight);
|
|
1277
1264
|
}
|
|
1278
1265
|
else {
|
|
1279
|
-
$
|
|
1266
|
+
$mol_assert_equal(error instanceof ErrorRight, true);
|
|
1280
1267
|
}
|
|
1281
1268
|
return error;
|
|
1282
1269
|
}
|
|
@@ -1286,58 +1273,47 @@ var $;
|
|
|
1286
1273
|
$mol_fail(new Error('Not failed'));
|
|
1287
1274
|
}
|
|
1288
1275
|
$.$mol_assert_fail = $mol_assert_fail;
|
|
1289
|
-
function $
|
|
1290
|
-
|
|
1291
|
-
for (let j = 0; j < args.length; ++j) {
|
|
1292
|
-
if (i === j)
|
|
1293
|
-
continue;
|
|
1294
|
-
if (Number.isNaN(args[i]) && Number.isNaN(args[j]))
|
|
1295
|
-
continue;
|
|
1296
|
-
if (args[i] !== args[j])
|
|
1297
|
-
$mol_fail(new Error(`Not equal (${i + 1}:${j + 1})\n${args[i]}\n${args[j]}`));
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1276
|
+
function $mol_assert_like(...args) {
|
|
1277
|
+
$mol_assert_equal(...args);
|
|
1300
1278
|
}
|
|
1301
|
-
$.$
|
|
1279
|
+
$.$mol_assert_like = $mol_assert_like;
|
|
1302
1280
|
function $mol_assert_unique(...args) {
|
|
1303
1281
|
for (let i = 0; i < args.length; ++i) {
|
|
1304
1282
|
for (let j = 0; j < args.length; ++j) {
|
|
1305
1283
|
if (i === j)
|
|
1306
1284
|
continue;
|
|
1307
|
-
if (
|
|
1308
|
-
|
|
1309
|
-
}
|
|
1285
|
+
if (!$mol_compare_deep(args[i], args[j]))
|
|
1286
|
+
continue;
|
|
1287
|
+
$mol_fail(new Error(`args[${i}] = args[${j}] = ${args[i]}`));
|
|
1310
1288
|
}
|
|
1311
1289
|
}
|
|
1312
1290
|
}
|
|
1313
1291
|
$.$mol_assert_unique = $mol_assert_unique;
|
|
1314
|
-
function $
|
|
1315
|
-
for (let
|
|
1316
|
-
if (
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
return val;
|
|
1322
|
-
if ('outerHTML' in val)
|
|
1323
|
-
return val.outerHTML;
|
|
1324
|
-
try {
|
|
1325
|
-
return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
|
|
1326
|
-
}
|
|
1327
|
-
catch (error) {
|
|
1328
|
-
console.error(error);
|
|
1329
|
-
return val;
|
|
1330
|
-
}
|
|
1331
|
-
};
|
|
1332
|
-
return $mol_fail(new Error(`Not like (1:${+index + 2})\n${print(head)}\n---\n${print(value)}`));
|
|
1333
|
-
}
|
|
1292
|
+
function $mol_assert_equal(...args) {
|
|
1293
|
+
for (let i = 1; i < args.length; ++i) {
|
|
1294
|
+
if ($mol_compare_deep(args[0], args[i]))
|
|
1295
|
+
continue;
|
|
1296
|
+
if (args[0] instanceof $mol_dom_context.Element && args[i] instanceof $mol_dom_context.Element && args[0].outerHTML === args[i].outerHTML)
|
|
1297
|
+
continue;
|
|
1298
|
+
return $mol_fail(new Error(`args[0] ≠ args[${i}]\n${print(args[0])}\n---\n${print(args[i])}`));
|
|
1334
1299
|
}
|
|
1335
1300
|
}
|
|
1336
|
-
$.$
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1301
|
+
$.$mol_assert_equal = $mol_assert_equal;
|
|
1302
|
+
const print = (val) => {
|
|
1303
|
+
if (!val)
|
|
1304
|
+
return val;
|
|
1305
|
+
if (typeof val !== 'object')
|
|
1306
|
+
return val;
|
|
1307
|
+
if ('outerHTML' in val)
|
|
1308
|
+
return val.outerHTML;
|
|
1309
|
+
try {
|
|
1310
|
+
return JSON.stringify(val, (k, v) => typeof v === 'bigint' ? String(v) : v, '\t');
|
|
1311
|
+
}
|
|
1312
|
+
catch (error) {
|
|
1313
|
+
console.error(error);
|
|
1314
|
+
return val;
|
|
1315
|
+
}
|
|
1316
|
+
};
|
|
1341
1317
|
})($ || ($ = {}));
|
|
1342
1318
|
//mol/assert/assert.ts
|
|
1343
1319
|
;
|
|
@@ -1358,10 +1334,10 @@ var $;
|
|
|
1358
1334
|
$mol_assert_equal(2, 2, 2);
|
|
1359
1335
|
},
|
|
1360
1336
|
'two must be unique'() {
|
|
1361
|
-
$mol_assert_unique([
|
|
1337
|
+
$mol_assert_unique([2], [3]);
|
|
1362
1338
|
},
|
|
1363
1339
|
'three must be unique'() {
|
|
1364
|
-
$mol_assert_unique([
|
|
1340
|
+
$mol_assert_unique([1], [2], [3]);
|
|
1365
1341
|
},
|
|
1366
1342
|
'two must be alike'() {
|
|
1367
1343
|
$mol_assert_like([3], [3]);
|
|
@@ -1692,7 +1668,7 @@ var $;
|
|
|
1692
1668
|
};
|
|
1693
1669
|
}
|
|
1694
1670
|
error(message, Class = Error) {
|
|
1695
|
-
return new Class(`${message}${this}`);
|
|
1671
|
+
return new Class(`${message} (${this})`);
|
|
1696
1672
|
}
|
|
1697
1673
|
span(row, col, length) {
|
|
1698
1674
|
return new $mol_span(this.uri, this.source, row, col, length);
|
|
@@ -1707,11 +1683,11 @@ var $;
|
|
|
1707
1683
|
if (end < 0)
|
|
1708
1684
|
end += len;
|
|
1709
1685
|
if (begin < 0 || begin > len)
|
|
1710
|
-
this.$.$mol_fail(`Begin value '${begin}' out of range
|
|
1686
|
+
this.$.$mol_fail(this.error(`Begin value '${begin}' out of range`, RangeError));
|
|
1711
1687
|
if (end < 0 || end > len)
|
|
1712
|
-
this.$.$mol_fail(`End value '${end}' out of range
|
|
1688
|
+
this.$.$mol_fail(this.error(`End value '${end}' out of range`, RangeError));
|
|
1713
1689
|
if (end < begin)
|
|
1714
|
-
this.$.$mol_fail(`End value '${end}' can't be less than begin value
|
|
1690
|
+
this.$.$mol_fail(this.error(`End value '${end}' can't be less than begin value`, RangeError));
|
|
1715
1691
|
return this.span(this.row, this.col + begin, end - begin);
|
|
1716
1692
|
}
|
|
1717
1693
|
}
|
|
@@ -1758,14 +1734,14 @@ var $;
|
|
|
1758
1734
|
},
|
|
1759
1735
|
'slice span - out of range'($) {
|
|
1760
1736
|
const span = new $mol_span('test.ts', '', 1, 3, 5);
|
|
1761
|
-
$mol_assert_fail(() => span.slice(-1, 3));
|
|
1762
|
-
$mol_assert_fail(() => span.slice(1, 6));
|
|
1763
|
-
$mol_assert_fail(() => span.slice(1, 10));
|
|
1737
|
+
$mol_assert_fail(() => span.slice(-1, 3), `End value '3' can't be less than begin value (test.ts#1:3/5)`);
|
|
1738
|
+
$mol_assert_fail(() => span.slice(1, 6), `End value '6' out of range (test.ts#1:3/5)`);
|
|
1739
|
+
$mol_assert_fail(() => span.slice(1, 10), `End value '10' out of range (test.ts#1:3/5)`);
|
|
1764
1740
|
},
|
|
1765
1741
|
'error handling'($) {
|
|
1766
1742
|
const span = new $mol_span('test.ts', '', 1, 3, 4);
|
|
1767
|
-
const error = span.error('Some error
|
|
1768
|
-
$mol_assert_equal(error.message, 'Some error
|
|
1743
|
+
const error = span.error('Some error');
|
|
1744
|
+
$mol_assert_equal(error.message, 'Some error (test.ts#1:3/4)');
|
|
1769
1745
|
}
|
|
1770
1746
|
});
|
|
1771
1747
|
})($ || ($ = {}));
|