@colyseus/schema 2.0.6 → 2.0.7
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 -3
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +15 -2
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +17 -3
- package/lib/Reflection.js.map +1 -1
- package/lib/Schema.js.map +1 -1
- package/lib/types/ArraySchema.d.ts +2 -0
- package/lib/types/ArraySchema.js +15 -2
- package/lib/types/ArraySchema.js.map +1 -1
- package/package.json +3 -3
- package/src/types/ArraySchema.ts +17 -2
package/build/esm/index.mjs
CHANGED
|
@@ -453,6 +453,7 @@ class ArraySchema {
|
|
|
453
453
|
* Combines two or more arrays.
|
|
454
454
|
* @param items Additional items to add to the end of array1.
|
|
455
455
|
*/
|
|
456
|
+
// @ts-ignore
|
|
456
457
|
concat(...items) {
|
|
457
458
|
return new ArraySchema(...Array.from(this.$items.values()).concat(...items));
|
|
458
459
|
}
|
|
@@ -466,6 +467,7 @@ class ArraySchema {
|
|
|
466
467
|
/**
|
|
467
468
|
* Reverses the elements in an Array.
|
|
468
469
|
*/
|
|
470
|
+
// @ts-ignore
|
|
469
471
|
reverse() {
|
|
470
472
|
const indexes = Array.from(this.$items.keys());
|
|
471
473
|
const reversedItems = Array.from(this.$items.values()).reverse();
|
|
@@ -493,7 +495,9 @@ class ArraySchema {
|
|
|
493
495
|
* @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
|
|
494
496
|
*/
|
|
495
497
|
slice(start, end) {
|
|
496
|
-
|
|
498
|
+
const sliced = new ArraySchema();
|
|
499
|
+
sliced.push(...Array.from(this.$items.values()).slice(start, end));
|
|
500
|
+
return sliced;
|
|
497
501
|
}
|
|
498
502
|
/**
|
|
499
503
|
* Sorts an array.
|
|
@@ -730,9 +734,18 @@ class ArraySchema {
|
|
|
730
734
|
*/
|
|
731
735
|
// @ts-ignore
|
|
732
736
|
flat(depth) {
|
|
733
|
-
// @ts-ignore
|
|
734
737
|
throw new Error("ArraySchema#flat() is not supported.");
|
|
735
738
|
}
|
|
739
|
+
findLast() {
|
|
740
|
+
const arr = Array.from(this.$items.values());
|
|
741
|
+
// @ts-ignore
|
|
742
|
+
return arr.findLast.apply(arr, arguments);
|
|
743
|
+
}
|
|
744
|
+
findLastIndex(...args) {
|
|
745
|
+
const arr = Array.from(this.$items.values());
|
|
746
|
+
// @ts-ignore
|
|
747
|
+
return arr.findLastIndex.apply(arr, arguments);
|
|
748
|
+
}
|
|
736
749
|
// get size () {
|
|
737
750
|
// return this.$items.size;
|
|
738
751
|
// }
|