@colyseus/schema 3.0.0-alpha.2 → 3.0.0-alpha.3

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.
@@ -1009,9 +1009,10 @@ const encodeArray = function (encoder, bytes, changeTree, field, operation, it,
1009
1009
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1010
1010
  * SOFTWARE
1011
1011
  */
1012
- function utf8Read(bytes, offset, length) {
1012
+ function utf8Read(bytes, it, length) {
1013
+ it.offset += length;
1013
1014
  var string = '', chr = 0;
1014
- for (var i = offset, end = offset + length; i < end; i++) {
1015
+ for (var i = it.offset, end = it.offset + length; i < end; i++) {
1015
1016
  var byte = bytes[i];
1016
1017
  if ((byte & 0x80) === 0x00) {
1017
1018
  string += String.fromCharCode(byte);
@@ -1113,9 +1114,7 @@ function string(bytes, it) {
1113
1114
  else if (prefix === 0xdb) {
1114
1115
  length = uint32(bytes, it);
1115
1116
  }
1116
- const value = utf8Read(bytes, it.offset, length);
1117
- it.offset += length;
1118
- return value;
1117
+ return utf8Read(bytes, it, length);
1119
1118
  }
1120
1119
  function stringCheck(bytes, it) {
1121
1120
  const prefix = bytes[it.offset];
@@ -1219,6 +1218,7 @@ function switchStructureCheck(bytes, it) {
1219
1218
 
1220
1219
  var decode = /*#__PURE__*/Object.freeze({
1221
1220
  __proto__: null,
1221
+ utf8Read: utf8Read,
1222
1222
  int8: int8,
1223
1223
  uint8: uint8,
1224
1224
  int16: int16,