feat[js]: javascript support compatible field

This commit is contained in:
sun
2023-09-27 17:50:41 +08:00
parent 3dc261eac8
commit 563d9099a1
2 changed files with 2 additions and 58 deletions
@@ -354,18 +354,6 @@ const ByteBuffer = function() {
return value;
};
this.writeChar = function(value) {
if (value === null || value === undefined || value.length === 0) {
this.writeString(empty_str);
return;
}
this.writeString(value.charAt(0));
};
this.readChar = function() {
return this.readString();
};
this.writeString = function(value) {
if (value === null || value === undefined || value.trim().length === 0) {
this.writeInt(0);
@@ -583,28 +571,6 @@ const ByteBuffer = function() {
return array;
};
this.writeCharArray = function(array) {
if (array === null) {
this.writeInt(0);
} else {
this.writeInt(array.length);
array.forEach(element => {
this.writeChar(element);
});
}
};
this.readCharArray = function() {
const array = [];
const length = this.readInt();
if (length > 0) {
for (let index = 0; index < length; index++) {
array.push(this.readChar());
}
}
return array;
};
this.writePacketArray = function(array, protocolId) {
if (array === null) {
this.writeInt(0);
@@ -694,14 +660,6 @@ const ByteBuffer = function() {
return this.readStringArray();
};
this.writeCharList = function(list) {
this.writeCharArray(list);
};
this.readCharList = function() {
return this.readCharArray();
};
this.writePacketList = function(list, protocolId) {
this.writePacketArray(list, protocolId);
};
@@ -831,21 +789,6 @@ const ByteBuffer = function() {
return new Set(this.readStringArray());
};
this.writeCharSet = function(set) {
if (set === null) {
this.writeInt(0);
} else {
this.writeInt(set.size);
set.forEach(element => {
this.writeChar(element);
});
}
};
this.readCharSet = function() {
return new Set(this.readCharArray());
};
this.writePacketSet = function(set, protocolId) {
if (set === null) {
this.writeInt(0);
@@ -1,6 +1,5 @@
/* eslint-disable */
// from https://github.com/dcodeIO/long.js/blob/master/src/long.js
module.exports = Long;
/**
* wasm optimizations, to do native i64 multiplication and divide
@@ -1323,3 +1322,5 @@ Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
unsigned
);
};
export default Long;