@colyseus/schema 3.0.0-alpha.2 → 3.0.0-alpha.4
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/build/cjs/index.js +5 -5
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +5 -5
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +5 -5
- package/lib/encoding/decode.d.ts +21 -19
- package/lib/encoding/decode.js +6 -6
- package/lib/encoding/decode.js.map +1 -1
- package/package.json +1 -1
- package/src/encoding/decode.ts +24 -25
package/build/cjs/index.js
CHANGED
|
@@ -1013,9 +1013,9 @@ const encodeArray = function (encoder, bytes, changeTree, field, operation, it,
|
|
|
1013
1013
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1014
1014
|
* SOFTWARE
|
|
1015
1015
|
*/
|
|
1016
|
-
function utf8Read(bytes,
|
|
1016
|
+
function utf8Read(bytes, it, length) {
|
|
1017
1017
|
var string = '', chr = 0;
|
|
1018
|
-
for (var i = offset, end = offset + length; i < end; i++) {
|
|
1018
|
+
for (var i = it.offset, end = it.offset + length; i < end; i++) {
|
|
1019
1019
|
var byte = bytes[i];
|
|
1020
1020
|
if ((byte & 0x80) === 0x00) {
|
|
1021
1021
|
string += String.fromCharCode(byte);
|
|
@@ -1050,6 +1050,7 @@ function utf8Read(bytes, offset, length) {
|
|
|
1050
1050
|
// (do not throw error to avoid server/client from crashing due to hack attemps)
|
|
1051
1051
|
// throw new Error('Invalid byte ' + byte.toString(16));
|
|
1052
1052
|
}
|
|
1053
|
+
it.offset += length;
|
|
1053
1054
|
return string;
|
|
1054
1055
|
}
|
|
1055
1056
|
function int8(bytes, it) {
|
|
@@ -1117,9 +1118,7 @@ function string(bytes, it) {
|
|
|
1117
1118
|
else if (prefix === 0xdb) {
|
|
1118
1119
|
length = uint32(bytes, it);
|
|
1119
1120
|
}
|
|
1120
|
-
|
|
1121
|
-
it.offset += length;
|
|
1122
|
-
return value;
|
|
1121
|
+
return utf8Read(bytes, it, length);
|
|
1123
1122
|
}
|
|
1124
1123
|
function stringCheck(bytes, it) {
|
|
1125
1124
|
const prefix = bytes[it.offset];
|
|
@@ -1223,6 +1222,7 @@ function switchStructureCheck(bytes, it) {
|
|
|
1223
1222
|
|
|
1224
1223
|
var decode = /*#__PURE__*/Object.freeze({
|
|
1225
1224
|
__proto__: null,
|
|
1225
|
+
utf8Read: utf8Read,
|
|
1226
1226
|
int8: int8,
|
|
1227
1227
|
uint8: uint8,
|
|
1228
1228
|
int16: int16,
|