@colyseus/schema 2.0.18 → 2.0.20

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.
@@ -395,6 +395,13 @@ function getArrayProxy(value) {
395
395
  }
396
396
  return true;
397
397
  },
398
+ has: function (obj, key) {
399
+ if (typeof (key) !== "symbol" &&
400
+ !isNaN(Number(key))) {
401
+ return obj['$items'].has(Number(key));
402
+ }
403
+ return Reflect.has(obj, key);
404
+ }
398
405
  });
399
406
  return value;
400
407
  }
@@ -2281,7 +2288,16 @@ var ReferenceTracker = /** @class */ (function () {
2281
2288
  };
2282
2289
  // for decoding
2283
2290
  ReferenceTracker.prototype.removeRef = function (refId) {
2284
- this.refCounts[refId] = this.refCounts[refId] - 1;
2291
+ var refCount = this.refCounts[refId];
2292
+ if (refCount === undefined) {
2293
+ console.warn("trying to remove reference ".concat(refId, " that doesn't exist"));
2294
+ return;
2295
+ }
2296
+ if (refCount === 0) {
2297
+ console.warn("trying to remove reference ".concat(refId, " with 0 refCount"));
2298
+ return;
2299
+ }
2300
+ this.refCounts[refId] = refCount - 1;
2285
2301
  this.deletedRefs.add(refId);
2286
2302
  };
2287
2303
  ReferenceTracker.prototype.clearRefs = function () {