@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.
- package/build/cjs/index.js +17 -1
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +17 -1
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +17 -1
- package/lib/changes/ReferenceTracker.d.ts +1 -1
- package/lib/changes/ReferenceTracker.js +10 -1
- package/lib/changes/ReferenceTracker.js.map +1 -1
- package/lib/types/ArraySchema.js +7 -0
- package/lib/types/ArraySchema.js.map +1 -1
- package/package.json +1 -1
- package/src/changes/ReferenceTracker.ts +12 -2
- package/src/types/ArraySchema.ts +10 -0
package/build/esm/index.mjs
CHANGED
|
@@ -336,6 +336,13 @@ function getArrayProxy(value) {
|
|
|
336
336
|
}
|
|
337
337
|
return true;
|
|
338
338
|
},
|
|
339
|
+
has: (obj, key) => {
|
|
340
|
+
if (typeof (key) !== "symbol" &&
|
|
341
|
+
!isNaN(Number(key))) {
|
|
342
|
+
return obj['$items'].has(Number(key));
|
|
343
|
+
}
|
|
344
|
+
return Reflect.has(obj, key);
|
|
345
|
+
}
|
|
339
346
|
});
|
|
340
347
|
return value;
|
|
341
348
|
}
|
|
@@ -2164,7 +2171,16 @@ class ReferenceTracker {
|
|
|
2164
2171
|
}
|
|
2165
2172
|
// for decoding
|
|
2166
2173
|
removeRef(refId) {
|
|
2167
|
-
|
|
2174
|
+
const refCount = this.refCounts[refId];
|
|
2175
|
+
if (refCount === undefined) {
|
|
2176
|
+
console.warn(`trying to remove reference ${refId} that doesn't exist`);
|
|
2177
|
+
return;
|
|
2178
|
+
}
|
|
2179
|
+
if (refCount === 0) {
|
|
2180
|
+
console.warn(`trying to remove reference ${refId} with 0 refCount`);
|
|
2181
|
+
return;
|
|
2182
|
+
}
|
|
2183
|
+
this.refCounts[refId] = refCount - 1;
|
|
2168
2184
|
this.deletedRefs.add(refId);
|
|
2169
2185
|
}
|
|
2170
2186
|
clearRefs() {
|