forked from olcxjas-softworks/LarpixClient
update electron to v43
This commit is contained in:
parent
68ac0beedf
commit
fb6c8b6ee9
5385 changed files with 513060 additions and 123058 deletions
24
electron/node_modules/@peculiar/utils/build/cjs/encoding/utf16.js
generated
vendored
Normal file
24
electron/node_modules/@peculiar/utils/build/cjs/encoding/utf16.js
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.utf16 = void 0;
|
||||
exports.encode = encode;
|
||||
exports.decode = decode;
|
||||
const index_js_1 = require("../bytes/index.js");
|
||||
function encode(text, options = {}) {
|
||||
const result = new ArrayBuffer(text.length * 2);
|
||||
const view = new DataView(result);
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
view.setUint16(i * 2, text.charCodeAt(i), options.littleEndian ?? false);
|
||||
}
|
||||
return new Uint8Array(result);
|
||||
}
|
||||
function decode(data, options = {}) {
|
||||
const buffer = (0, index_js_1.toArrayBuffer)(data);
|
||||
const view = new DataView(buffer);
|
||||
let result = "";
|
||||
for (let i = 0; i < buffer.byteLength; i += 2) {
|
||||
result += String.fromCharCode(view.getUint16(i, options.littleEndian ?? false));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
exports.utf16 = { encode, decode };
|
||||
Loading…
Add table
Add a link
Reference in a new issue