mol_dump_lib 0.0.942 → 0.0.944
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.d.ts +4 -0
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +31 -5
- package/node.js.map +1 -1
- package/node.mjs +31 -5
- package/node.test.js +55 -6
- package/node.test.js.map +1 -1
- package/package.json +3 -1
- package/web.js +4 -4
- package/web.js.map +1 -1
- package/web.mjs +4 -4
package/node.mjs
CHANGED
|
@@ -1739,6 +1739,30 @@ var $;
|
|
|
1739
1739
|
$.$mol_tree2_from_string = $mol_tree2_from_string;
|
|
1740
1740
|
})($ || ($ = {}));
|
|
1741
1741
|
|
|
1742
|
+
;
|
|
1743
|
+
"use strict";
|
|
1744
|
+
var $;
|
|
1745
|
+
(function ($) {
|
|
1746
|
+
function $mol_array_chunks(array, rule) {
|
|
1747
|
+
const br = typeof rule === 'number' ? (_, i) => i % rule === 0 : rule;
|
|
1748
|
+
let chunk = [];
|
|
1749
|
+
const chunks = [];
|
|
1750
|
+
for (let i = 0; i < array.length; ++i) {
|
|
1751
|
+
const item = array[i];
|
|
1752
|
+
if (br(item, i)) {
|
|
1753
|
+
if (chunk.length)
|
|
1754
|
+
chunks.push(chunk);
|
|
1755
|
+
chunk = [];
|
|
1756
|
+
}
|
|
1757
|
+
chunk.push(item);
|
|
1758
|
+
}
|
|
1759
|
+
if (chunk.length)
|
|
1760
|
+
chunks.push(chunk);
|
|
1761
|
+
return chunks;
|
|
1762
|
+
}
|
|
1763
|
+
$.$mol_array_chunks = $mol_array_chunks;
|
|
1764
|
+
})($ || ($ = {}));
|
|
1765
|
+
|
|
1742
1766
|
;
|
|
1743
1767
|
"use strict";
|
|
1744
1768
|
var $;
|
|
@@ -1759,7 +1783,9 @@ var $;
|
|
|
1759
1783
|
}
|
|
1760
1784
|
if (ArrayBuffer.isView(json)) {
|
|
1761
1785
|
const buf = new Uint8Array(json.buffer, json.byteOffset, json.byteLength);
|
|
1762
|
-
|
|
1786
|
+
const codes = [...buf].map(b => b.toString(16).toUpperCase().padStart(2, '0'));
|
|
1787
|
+
const str = $mol_array_chunks(codes, 8).map(c => c.join(' ')).join('\n');
|
|
1788
|
+
return $mol_tree2.data(str, [], span);
|
|
1763
1789
|
}
|
|
1764
1790
|
if (json instanceof Date) {
|
|
1765
1791
|
return new $mol_tree2('', json.toISOString(), [], span);
|
|
@@ -5690,13 +5716,13 @@ var $;
|
|
|
5690
5716
|
'code-comment-inline': /\/\/.*?(?:$|\/\/)|- \\(?!\\).*|#!? .*/,
|
|
5691
5717
|
'code-string': /(?:".*?"|'.*?'|`.*?`| ?\\\\.+?\\\\|\/.+?\/[dygimsu]*(?!\p{Letter})|[ \t]*\\[^\n]*)/u,
|
|
5692
5718
|
'code-number': /[+-]?(?:\d*\.)?\d+\w*/,
|
|
5693
|
-
'code-call': /\.?\w+
|
|
5719
|
+
'code-call': /\.?\w+(?=\()/,
|
|
5694
5720
|
'code-sexpr': /\((\w+ )/,
|
|
5695
|
-
'code-field': /(?:(
|
|
5696
|
-
'code-keyword':
|
|
5721
|
+
'code-field': /(?:(?<=\.|::|->)[a-z][\w-]*|(?<=[, \t] |\t)[\w-]+\??:(?!\/\/|:))/,
|
|
5722
|
+
'code-keyword': /(?<=^|\t|[ )(}{=] )((throw|readonly|unknown|keyof|typeof|never|from|class|struct|interface|type|function|extends|implements|module|namespace|import|export|include|require|var|val|let|const|for|do|while|until|in|out|of|new|if|then|else|switch|case|return|async|await|yield|try|catch|break|continue|get|set|public|private|protected|void|int|float|ref)( |$|;))+/,
|
|
5697
5723
|
'code-global': /[$]+\w*|\b[A-Z][a-z0-9]+[A-Z]\w*/,
|
|
5698
5724
|
'code-word': /\w+/,
|
|
5699
|
-
'code-decorator':
|
|
5725
|
+
'code-decorator': /(?<=^| |\t)@\s*\S+/,
|
|
5700
5726
|
'code-tag': /<\/?[\w-]+\/?>?|&\w+;/,
|
|
5701
5727
|
'code-punctuation': /[\-\[\]\{\}\(\)<=>~!\?@#%&\*_\+\\\/\|;:\.,\^]+?/,
|
|
5702
5728
|
});
|
package/node.test.js
CHANGED
|
@@ -1730,6 +1730,30 @@ var $;
|
|
|
1730
1730
|
$.$mol_tree2_from_string = $mol_tree2_from_string;
|
|
1731
1731
|
})($ || ($ = {}));
|
|
1732
1732
|
|
|
1733
|
+
;
|
|
1734
|
+
"use strict";
|
|
1735
|
+
var $;
|
|
1736
|
+
(function ($) {
|
|
1737
|
+
function $mol_array_chunks(array, rule) {
|
|
1738
|
+
const br = typeof rule === 'number' ? (_, i) => i % rule === 0 : rule;
|
|
1739
|
+
let chunk = [];
|
|
1740
|
+
const chunks = [];
|
|
1741
|
+
for (let i = 0; i < array.length; ++i) {
|
|
1742
|
+
const item = array[i];
|
|
1743
|
+
if (br(item, i)) {
|
|
1744
|
+
if (chunk.length)
|
|
1745
|
+
chunks.push(chunk);
|
|
1746
|
+
chunk = [];
|
|
1747
|
+
}
|
|
1748
|
+
chunk.push(item);
|
|
1749
|
+
}
|
|
1750
|
+
if (chunk.length)
|
|
1751
|
+
chunks.push(chunk);
|
|
1752
|
+
return chunks;
|
|
1753
|
+
}
|
|
1754
|
+
$.$mol_array_chunks = $mol_array_chunks;
|
|
1755
|
+
})($ || ($ = {}));
|
|
1756
|
+
|
|
1733
1757
|
;
|
|
1734
1758
|
"use strict";
|
|
1735
1759
|
var $;
|
|
@@ -1750,7 +1774,9 @@ var $;
|
|
|
1750
1774
|
}
|
|
1751
1775
|
if (ArrayBuffer.isView(json)) {
|
|
1752
1776
|
const buf = new Uint8Array(json.buffer, json.byteOffset, json.byteLength);
|
|
1753
|
-
|
|
1777
|
+
const codes = [...buf].map(b => b.toString(16).toUpperCase().padStart(2, '0'));
|
|
1778
|
+
const str = $mol_array_chunks(codes, 8).map(c => c.join(' ')).join('\n');
|
|
1779
|
+
return $mol_tree2.data(str, [], span);
|
|
1754
1780
|
}
|
|
1755
1781
|
if (json instanceof Date) {
|
|
1756
1782
|
return new $mol_tree2('', json.toISOString(), [], span);
|
|
@@ -5681,13 +5707,13 @@ var $;
|
|
|
5681
5707
|
'code-comment-inline': /\/\/.*?(?:$|\/\/)|- \\(?!\\).*|#!? .*/,
|
|
5682
5708
|
'code-string': /(?:".*?"|'.*?'|`.*?`| ?\\\\.+?\\\\|\/.+?\/[dygimsu]*(?!\p{Letter})|[ \t]*\\[^\n]*)/u,
|
|
5683
5709
|
'code-number': /[+-]?(?:\d*\.)?\d+\w*/,
|
|
5684
|
-
'code-call': /\.?\w+
|
|
5710
|
+
'code-call': /\.?\w+(?=\()/,
|
|
5685
5711
|
'code-sexpr': /\((\w+ )/,
|
|
5686
|
-
'code-field': /(?:(
|
|
5687
|
-
'code-keyword':
|
|
5712
|
+
'code-field': /(?:(?<=\.|::|->)[a-z][\w-]*|(?<=[, \t] |\t)[\w-]+\??:(?!\/\/|:))/,
|
|
5713
|
+
'code-keyword': /(?<=^|\t|[ )(}{=] )((throw|readonly|unknown|keyof|typeof|never|from|class|struct|interface|type|function|extends|implements|module|namespace|import|export|include|require|var|val|let|const|for|do|while|until|in|out|of|new|if|then|else|switch|case|return|async|await|yield|try|catch|break|continue|get|set|public|private|protected|void|int|float|ref)( |$|;))+/,
|
|
5688
5714
|
'code-global': /[$]+\w*|\b[A-Z][a-z0-9]+[A-Z]\w*/,
|
|
5689
5715
|
'code-word': /\w+/,
|
|
5690
|
-
'code-decorator':
|
|
5716
|
+
'code-decorator': /(?<=^| |\t)@\s*\S+/,
|
|
5691
5717
|
'code-tag': /<\/?[\w-]+\/?>?|&\w+;/,
|
|
5692
5718
|
'code-punctuation': /[\-\[\]\{\}\(\)<=>~!\?@#%&\*_\+\\\/\|;:\.,\^]+?/,
|
|
5693
5719
|
});
|
|
@@ -8108,6 +8134,29 @@ var $;
|
|
|
8108
8134
|
});
|
|
8109
8135
|
})($ || ($ = {}));
|
|
8110
8136
|
|
|
8137
|
+
;
|
|
8138
|
+
"use strict";
|
|
8139
|
+
var $;
|
|
8140
|
+
(function ($) {
|
|
8141
|
+
$mol_test({
|
|
8142
|
+
'empty array'() {
|
|
8143
|
+
$mol_assert_equal($mol_array_chunks([], () => true), []);
|
|
8144
|
+
},
|
|
8145
|
+
'one chunk'() {
|
|
8146
|
+
$mol_assert_equal($mol_array_chunks([1, 2, 3, 4, 5], () => false), [[1, 2, 3, 4, 5]]);
|
|
8147
|
+
},
|
|
8148
|
+
'fixed size chunk'() {
|
|
8149
|
+
$mol_assert_equal($mol_array_chunks([1, 2, 3, 4, 5], 3), [[1, 2, 3], [4, 5]]);
|
|
8150
|
+
},
|
|
8151
|
+
'first empty chunk'() {
|
|
8152
|
+
$mol_assert_equal($mol_array_chunks([1, 2, 3, 4, 5], (_, i) => i === 0), [[1, 2, 3, 4, 5]]);
|
|
8153
|
+
},
|
|
8154
|
+
'chunk for every item'() {
|
|
8155
|
+
$mol_assert_equal($mol_array_chunks([1, 2, 3, 4, 5], () => true), [[1], [2], [3], [4], [5]]);
|
|
8156
|
+
},
|
|
8157
|
+
});
|
|
8158
|
+
})($ || ($ = {}));
|
|
8159
|
+
|
|
8111
8160
|
;
|
|
8112
8161
|
"use strict";
|
|
8113
8162
|
var $;
|
|
@@ -8187,7 +8236,7 @@ var $;
|
|
|
8187
8236
|
$mol_assert_equal($mol_tree2_from_json([]).toString(), '/\n');
|
|
8188
8237
|
$mol_assert_equal($mol_tree2_from_json([false, true]).toString(), '/\n\tfalse\n\ttrue\n');
|
|
8189
8238
|
$mol_assert_equal($mol_tree2_from_json([0, 1, 2.3]).toString(), '/\n\t0\n\t1\n\t2.3\n');
|
|
8190
|
-
$mol_assert_equal($mol_tree2_from_json(new Uint16Array([1, 10, 256])).toString(), '
|
|
8239
|
+
$mol_assert_equal($mol_tree2_from_json(new Uint16Array([1, 10, 255, 256, 65535])).toString(), '\\01 00 0A 00 FF 00 00 01\n\\FF FF\n');
|
|
8191
8240
|
$mol_assert_equal($mol_tree2_from_json(['', 'foo', 'bar\nbaz']).toString(), '/\n\t\\\n\t\\foo\n\t\\\n\t\t\\bar\n\t\t\\baz\n');
|
|
8192
8241
|
$mol_assert_equal($mol_tree2_from_json({ 'foo': false, 'bar\nbaz': 'lol' }).toString(), '*\n\tfoo false\n\t\\\n\t\t\\bar\n\t\t\\baz\n\t\t\\lol\n');
|
|
8193
8242
|
},
|