@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/esm/index.mjs
CHANGED
|
@@ -729,6 +729,9 @@ class ArraySchema {
|
|
|
729
729
|
includes(searchElement, fromIndex) {
|
|
730
730
|
return Array.from(this.$items.values()).includes(searchElement, fromIndex);
|
|
731
731
|
}
|
|
732
|
+
//
|
|
733
|
+
// ES2022
|
|
734
|
+
//
|
|
732
735
|
/**
|
|
733
736
|
* Calls a defined callback function on each element of an array. Then, flattens the result into
|
|
734
737
|
* a new array.
|
|
@@ -764,9 +767,26 @@ class ArraySchema {
|
|
|
764
767
|
// @ts-ignore
|
|
765
768
|
return arr.findLastIndex.apply(arr, arguments);
|
|
766
769
|
}
|
|
767
|
-
//
|
|
768
|
-
//
|
|
769
|
-
//
|
|
770
|
+
//
|
|
771
|
+
// ES2023
|
|
772
|
+
//
|
|
773
|
+
with(index, value) {
|
|
774
|
+
const copy = Array.from(this.$items.values());
|
|
775
|
+
copy[index] = value;
|
|
776
|
+
return new ArraySchema(...copy);
|
|
777
|
+
}
|
|
778
|
+
toReversed() {
|
|
779
|
+
return Array.from(this.$items.values()).reverse();
|
|
780
|
+
}
|
|
781
|
+
toSorted(compareFn) {
|
|
782
|
+
return Array.from(this.$items.values()).sort(compareFn);
|
|
783
|
+
}
|
|
784
|
+
// @ts-ignore
|
|
785
|
+
toSpliced(start, deleteCount, ...items) {
|
|
786
|
+
const copy = Array.from(this.$items.values());
|
|
787
|
+
// @ts-ignore
|
|
788
|
+
return copy.toSpliced.apply(copy, arguments);
|
|
789
|
+
}
|
|
770
790
|
setIndex(index, key) {
|
|
771
791
|
this.$indexes.set(index, key);
|
|
772
792
|
}
|