@colyseus/schema 2.0.20 → 2.0.21
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 +23 -3
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +23 -3
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +23 -3
- package/lib/types/ArraySchema.d.ts +5 -0
- package/lib/types/ArraySchema.js +23 -3
- package/lib/types/ArraySchema.js.map +1 -1
- package/package.json +2 -2
- package/src/types/ArraySchema.ts +26 -3
package/build/cjs/index.js
CHANGED
|
@@ -813,6 +813,9 @@ var ArraySchema = /** @class */ (function () {
|
|
|
813
813
|
ArraySchema.prototype.includes = function (searchElement, fromIndex) {
|
|
814
814
|
return Array.from(this.$items.values()).includes(searchElement, fromIndex);
|
|
815
815
|
};
|
|
816
|
+
//
|
|
817
|
+
// ES2022
|
|
818
|
+
//
|
|
816
819
|
/**
|
|
817
820
|
* Calls a defined callback function on each element of an array. Then, flattens the result into
|
|
818
821
|
* a new array.
|
|
@@ -848,9 +851,26 @@ var ArraySchema = /** @class */ (function () {
|
|
|
848
851
|
// @ts-ignore
|
|
849
852
|
return arr.findLastIndex.apply(arr, arguments);
|
|
850
853
|
};
|
|
851
|
-
//
|
|
852
|
-
//
|
|
853
|
-
//
|
|
854
|
+
//
|
|
855
|
+
// ES2023
|
|
856
|
+
//
|
|
857
|
+
ArraySchema.prototype.with = function (index, value) {
|
|
858
|
+
var copy = Array.from(this.$items.values());
|
|
859
|
+
copy[index] = value;
|
|
860
|
+
return new (ArraySchema.bind.apply(ArraySchema, __spreadArray([void 0], copy, false)))();
|
|
861
|
+
};
|
|
862
|
+
ArraySchema.prototype.toReversed = function () {
|
|
863
|
+
return Array.from(this.$items.values()).reverse();
|
|
864
|
+
};
|
|
865
|
+
ArraySchema.prototype.toSorted = function (compareFn) {
|
|
866
|
+
return Array.from(this.$items.values()).sort(compareFn);
|
|
867
|
+
};
|
|
868
|
+
// @ts-ignore
|
|
869
|
+
ArraySchema.prototype.toSpliced = function (start, deleteCount) {
|
|
870
|
+
var copy = Array.from(this.$items.values());
|
|
871
|
+
// @ts-ignore
|
|
872
|
+
return copy.toSpliced.apply(copy, arguments);
|
|
873
|
+
};
|
|
854
874
|
ArraySchema.prototype.setIndex = function (index, key) {
|
|
855
875
|
this.$indexes.set(index, key);
|
|
856
876
|
};
|