mol_dump_lib 0.0.869 → 0.0.870
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 +2 -1
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +33 -4
- package/node.js.map +1 -1
- package/node.mjs +33 -4
- package/node.test.js +50 -8
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +2 -1
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +33 -4
- package/web.js.map +1 -1
- package/web.mjs +33 -4
- package/web.test.js +17 -4
- package/web.test.js.map +1 -1
package/web.js
CHANGED
|
@@ -5527,12 +5527,41 @@ var $;
|
|
|
5527
5527
|
"use strict";
|
|
5528
5528
|
var $;
|
|
5529
5529
|
(function ($) {
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5530
|
+
let buf = new Uint8Array(2 ** 12);
|
|
5531
|
+
function $mol_charset_encode(str) {
|
|
5532
|
+
const capacity = str.length * 3;
|
|
5533
|
+
if (buf.byteLength < capacity)
|
|
5534
|
+
buf = new Uint8Array(capacity);
|
|
5535
|
+
return buf.slice(0, $mol_charset_encode_to(str, buf));
|
|
5534
5536
|
}
|
|
5535
5537
|
$.$mol_charset_encode = $mol_charset_encode;
|
|
5538
|
+
function $mol_charset_encode_to(str, buf, from = 0) {
|
|
5539
|
+
let pos = from;
|
|
5540
|
+
for (let i = 0; i < str.length; i++) {
|
|
5541
|
+
let code = str.charCodeAt(i);
|
|
5542
|
+
if (code < 0x80) {
|
|
5543
|
+
buf[pos++] = code;
|
|
5544
|
+
}
|
|
5545
|
+
else if (code < 0x800) {
|
|
5546
|
+
buf[pos++] = 0xc0 | (code >> 6);
|
|
5547
|
+
buf[pos++] = 0x80 | (code & 0x3f);
|
|
5548
|
+
}
|
|
5549
|
+
else if (code < 0xd800 || code >= 0xe000) {
|
|
5550
|
+
buf[pos++] = 0xe0 | (code >> 12);
|
|
5551
|
+
buf[pos++] = 0x80 | ((code >> 6) & 0x3f);
|
|
5552
|
+
buf[pos++] = 0x80 | (code & 0x3f);
|
|
5553
|
+
}
|
|
5554
|
+
else {
|
|
5555
|
+
const point = ((code - 0xd800) << 10) + str.charCodeAt(++i) + 0x2400;
|
|
5556
|
+
buf[pos++] = 0xf0 | (point >> 18);
|
|
5557
|
+
buf[pos++] = 0x80 | ((point >> 12) & 0x3f);
|
|
5558
|
+
buf[pos++] = 0x80 | ((point >> 6) & 0x3f);
|
|
5559
|
+
buf[pos++] = 0x80 | (point & 0x3f);
|
|
5560
|
+
}
|
|
5561
|
+
}
|
|
5562
|
+
return pos - from;
|
|
5563
|
+
}
|
|
5564
|
+
$.$mol_charset_encode_to = $mol_charset_encode_to;
|
|
5536
5565
|
})($ || ($ = {}));
|
|
5537
5566
|
|
|
5538
5567
|
;
|