@colyseus/schema 3.0.75 → 4.0.0

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.
Files changed (157) hide show
  1. package/build/cjs/index.js +780 -429
  2. package/build/cjs/index.js.map +1 -1
  3. package/build/esm/index.mjs +778 -430
  4. package/build/esm/index.mjs.map +1 -1
  5. package/build/umd/index.js +780 -429
  6. package/lib/Reflection.d.ts +50 -17
  7. package/lib/Reflection.js +151 -202
  8. package/lib/Reflection.js.map +1 -1
  9. package/lib/Schema.d.ts +13 -1
  10. package/lib/Schema.js +73 -9
  11. package/lib/Schema.js.map +1 -1
  12. package/lib/annotations.d.ts +6 -1
  13. package/lib/annotations.js +8 -34
  14. package/lib/annotations.js.map +1 -1
  15. package/lib/bench_encode.js +34 -1
  16. package/lib/bench_encode.js.map +1 -1
  17. package/lib/codegen/api.js +35 -2
  18. package/lib/codegen/api.js.map +1 -1
  19. package/lib/codegen/cli.js +4 -1
  20. package/lib/codegen/cli.js.map +1 -1
  21. package/lib/codegen/parser.js +35 -2
  22. package/lib/codegen/parser.js.map +1 -1
  23. package/lib/codegen/types.js +34 -1
  24. package/lib/codegen/types.js.map +1 -1
  25. package/lib/decoder/DecodeOperation.d.ts +2 -2
  26. package/lib/decoder/DecodeOperation.js +3 -3
  27. package/lib/decoder/DecodeOperation.js.map +1 -1
  28. package/lib/decoder/Decoder.d.ts +3 -3
  29. package/lib/decoder/Decoder.js +2 -2
  30. package/lib/decoder/Decoder.js.map +1 -1
  31. package/lib/decoder/ReferenceTracker.d.ts +0 -1
  32. package/lib/decoder/ReferenceTracker.js +9 -7
  33. package/lib/decoder/ReferenceTracker.js.map +1 -1
  34. package/lib/decoder/strategy/Callbacks.d.ts +154 -0
  35. package/lib/decoder/strategy/Callbacks.js +340 -0
  36. package/lib/decoder/strategy/Callbacks.js.map +1 -0
  37. package/lib/decoder/strategy/{StateCallbacks.d.ts → getDecoderStateCallbacks.d.ts} +6 -0
  38. package/lib/decoder/strategy/{StateCallbacks.js → getDecoderStateCallbacks.js} +17 -10
  39. package/lib/decoder/strategy/getDecoderStateCallbacks.js.map +1 -0
  40. package/lib/encoder/ChangeTree.d.ts +2 -2
  41. package/lib/encoder/ChangeTree.js.map +1 -1
  42. package/lib/encoder/EncodeOperation.d.ts +2 -2
  43. package/lib/encoder/EncodeOperation.js +3 -3
  44. package/lib/encoder/EncodeOperation.js.map +1 -1
  45. package/lib/encoder/Encoder.d.ts +6 -6
  46. package/lib/encoder/Encoder.js +19 -18
  47. package/lib/encoder/Encoder.js.map +1 -1
  48. package/lib/encoder/Root.js +17 -14
  49. package/lib/encoder/Root.js.map +1 -1
  50. package/lib/encoder/StateView.js +13 -12
  51. package/lib/encoder/StateView.js.map +1 -1
  52. package/lib/encoding/decode.d.ts +2 -2
  53. package/lib/encoding/encode.d.ts +3 -1
  54. package/lib/encoding/encode.js.map +1 -1
  55. package/lib/index.d.ts +3 -2
  56. package/lib/index.js +7 -3
  57. package/lib/index.js.map +1 -1
  58. package/lib/types/HelperTypes.d.ts +7 -14
  59. package/lib/types/HelperTypes.js.map +1 -1
  60. package/lib/types/custom/ArraySchema.d.ts +2 -1
  61. package/lib/types/custom/ArraySchema.js.map +1 -1
  62. package/lib/types/custom/CollectionSchema.d.ts +2 -1
  63. package/lib/types/custom/CollectionSchema.js.map +1 -1
  64. package/lib/types/custom/MapSchema.d.ts +3 -2
  65. package/lib/types/custom/MapSchema.js.map +1 -1
  66. package/lib/types/custom/SetSchema.d.ts +2 -1
  67. package/lib/types/custom/SetSchema.js.map +1 -1
  68. package/lib/types/symbols.d.ts +1 -0
  69. package/lib/types/symbols.js +2 -1
  70. package/lib/types/symbols.js.map +1 -1
  71. package/lib/utils.js +1 -1
  72. package/lib/utils.js.map +1 -1
  73. package/package.json +12 -16
  74. package/src/Reflection.ts +185 -174
  75. package/src/Schema.ts +81 -13
  76. package/src/annotations.ts +14 -40
  77. package/src/codegen/parser.ts +1 -1
  78. package/src/decoder/DecodeOperation.ts +9 -9
  79. package/src/decoder/Decoder.ts +6 -6
  80. package/src/decoder/ReferenceTracker.ts +10 -8
  81. package/src/decoder/strategy/Callbacks.ts +547 -0
  82. package/src/decoder/strategy/{StateCallbacks.ts → getDecoderStateCallbacks.ts} +17 -11
  83. package/src/encoder/ChangeTree.ts +4 -7
  84. package/src/encoder/EncodeOperation.ts +9 -9
  85. package/src/encoder/Encoder.ts +26 -18
  86. package/src/encoder/Root.ts +20 -15
  87. package/src/encoder/StateView.ts +15 -13
  88. package/src/encoding/encode.ts +1 -1
  89. package/src/index.ts +3 -2
  90. package/src/types/HelperTypes.ts +13 -11
  91. package/src/types/custom/ArraySchema.ts +2 -1
  92. package/src/types/custom/CollectionSchema.ts +4 -2
  93. package/src/types/custom/MapSchema.ts +4 -2
  94. package/src/types/custom/SetSchema.ts +3 -1
  95. package/src/types/symbols.ts +1 -0
  96. package/src/utils.ts +2 -2
  97. package/lib/Decoder.d.ts +0 -16
  98. package/lib/Decoder.js +0 -182
  99. package/lib/Decoder.js.map +0 -1
  100. package/lib/Encoder.d.ts +0 -13
  101. package/lib/Encoder.js +0 -79
  102. package/lib/Encoder.js.map +0 -1
  103. package/lib/changes/ChangeSet.d.ts +0 -12
  104. package/lib/changes/ChangeSet.js +0 -35
  105. package/lib/changes/ChangeSet.js.map +0 -1
  106. package/lib/changes/ChangeTree.d.ts +0 -53
  107. package/lib/changes/ChangeTree.js +0 -202
  108. package/lib/changes/ChangeTree.js.map +0 -1
  109. package/lib/changes/DecodeOperation.d.ts +0 -15
  110. package/lib/changes/DecodeOperation.js +0 -186
  111. package/lib/changes/DecodeOperation.js.map +0 -1
  112. package/lib/changes/EncodeOperation.d.ts +0 -18
  113. package/lib/changes/EncodeOperation.js +0 -130
  114. package/lib/changes/EncodeOperation.js.map +0 -1
  115. package/lib/changes/ReferenceTracker.d.ts +0 -14
  116. package/lib/changes/ReferenceTracker.js +0 -83
  117. package/lib/changes/ReferenceTracker.js.map +0 -1
  118. package/lib/changes/consts.d.ts +0 -14
  119. package/lib/changes/consts.js +0 -18
  120. package/lib/changes/consts.js.map +0 -1
  121. package/lib/decoder/strategy/StateCallbacks.js.map +0 -1
  122. package/lib/decoding/decode.d.ts +0 -48
  123. package/lib/decoding/decode.js +0 -267
  124. package/lib/decoding/decode.js.map +0 -1
  125. package/lib/ecs.d.ts +0 -11
  126. package/lib/ecs.js +0 -160
  127. package/lib/ecs.js.map +0 -1
  128. package/lib/filters/index.d.ts +0 -8
  129. package/lib/filters/index.js +0 -24
  130. package/lib/filters/index.js.map +0 -1
  131. package/lib/spec.d.ts +0 -13
  132. package/lib/spec.js +0 -42
  133. package/lib/spec.js.map +0 -1
  134. package/lib/types/ArraySchema.d.ts +0 -238
  135. package/lib/types/ArraySchema.js +0 -555
  136. package/lib/types/ArraySchema.js.map +0 -1
  137. package/lib/types/CollectionSchema.d.ts +0 -35
  138. package/lib/types/CollectionSchema.js +0 -150
  139. package/lib/types/CollectionSchema.js.map +0 -1
  140. package/lib/types/MapSchema.d.ts +0 -38
  141. package/lib/types/MapSchema.js +0 -215
  142. package/lib/types/MapSchema.js.map +0 -1
  143. package/lib/types/SetSchema.d.ts +0 -32
  144. package/lib/types/SetSchema.js +0 -162
  145. package/lib/types/SetSchema.js.map +0 -1
  146. package/lib/types/typeRegistry.d.ts +0 -5
  147. package/lib/types/typeRegistry.js +0 -13
  148. package/lib/types/typeRegistry.js.map +0 -1
  149. package/lib/usage.d.ts +0 -1
  150. package/lib/usage.js +0 -22
  151. package/lib/usage.js.map +0 -1
  152. package/lib/v3.d.ts +0 -1
  153. package/lib/v3.js +0 -427
  154. package/lib/v3.js.map +0 -1
  155. package/lib/v3_experiment.d.ts +0 -1
  156. package/lib/v3_experiment.js +0 -407
  157. package/lib/v3_experiment.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/filters/index.ts"],"names":[],"mappings":";;;AAGA,MAAa,WAAW;IAAxB;QACI,WAAM,GAAG,IAAI,OAAO,EAAc,CAAC;QACnC,qBAAgB,GAAG,IAAI,OAAO,EAA2B,CAAC;IAiB9D,CAAC;IAhBG,yDAAyD;IAEzD,QAAQ,CAAC,UAAsB;QAC3B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC5B,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,MAA2B;QAClC,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;YACpC,MAAM,CAAC,YAAY,GAAG,IAAI,WAAW,EAAE,CAAC;QAC5C,CAAC;QAED,OAAO,MAAM,CAAC,YAA2B,CAAC;IAC9C,CAAC;CACJ;AAnBD,kCAmBC","sourcesContent":["import { ChangeTree } from \"../changes/ChangeTree\";\nimport { ClientWithSessionId } from \"../annotations\";\n\nexport class ClientState {\n refIds = new WeakSet<ChangeTree>();\n containerIndexes = new WeakMap<ChangeTree, Set<number>>();\n // containerIndexes = new Map<ChangeTree, Set<number>>();\n\n addRefId(changeTree: ChangeTree) {\n if (!this.refIds.has(changeTree)) {\n this.refIds.add(changeTree);\n this.containerIndexes.set(changeTree, new Set());\n }\n }\n\n static get(client: ClientWithSessionId) {\n if (client.$filterState === undefined) {\n client.$filterState = new ClientState();\n }\n\n return client.$filterState as ClientState;\n }\n}\n"]}
package/lib/spec.d.ts DELETED
@@ -1,13 +0,0 @@
1
- export declare const SWITCH_TO_STRUCTURE = 255;
2
- export declare const TYPE_ID = 213;
3
- /**
4
- * Encoding Schema field operations.
5
- */
6
- export declare enum OPERATION {
7
- ADD = 128,
8
- REPLACE = 0,
9
- DELETE = 64,
10
- DELETE_AND_ADD = 192,// 11100000
11
- TOUCH = 1,// 00000000
12
- CLEAR = 10
13
- }
package/lib/spec.js DELETED
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OPERATION = exports.TYPE_ID = exports.SWITCH_TO_STRUCTURE = void 0;
4
- // export const SWITCH_TO_STRUCTURE = 193; (easily collides with DELETE_AND_ADD + fieldIndex = 2)
5
- exports.SWITCH_TO_STRUCTURE = 255; // (decoding collides with DELETE_AND_ADD + fieldIndex = 63)
6
- exports.TYPE_ID = 213;
7
- /**
8
- * Encoding Schema field operations.
9
- */
10
- var OPERATION;
11
- (function (OPERATION) {
12
- // add new structure/primitive
13
- OPERATION[OPERATION["ADD"] = 128] = "ADD";
14
- // replace structure/primitive
15
- OPERATION[OPERATION["REPLACE"] = 0] = "REPLACE";
16
- // delete field
17
- OPERATION[OPERATION["DELETE"] = 64] = "DELETE";
18
- // DELETE field, followed by an ADD
19
- OPERATION[OPERATION["DELETE_AND_ADD"] = 192] = "DELETE_AND_ADD";
20
- // TOUCH is used to determine hierarchy of nested Schema structures during serialization.
21
- // touches are NOT encoded.
22
- OPERATION[OPERATION["TOUCH"] = 1] = "TOUCH";
23
- // MapSchema Operations
24
- OPERATION[OPERATION["CLEAR"] = 10] = "CLEAR";
25
- })(OPERATION || (exports.OPERATION = OPERATION = {}));
26
- // export enum OPERATION {
27
- // // add new structure/primitive
28
- // // (128)
29
- // ADD = 128, // 10000000,
30
- // // replace structure/primitive
31
- // REPLACE = 1,// 00000001
32
- // // delete field
33
- // DELETE = 192, // 11000000
34
- // // DELETE field, followed by an ADD
35
- // DELETE_AND_ADD = 224, // 11100000
36
- // // TOUCH is used to determine hierarchy of nested Schema structures during serialization.
37
- // // touches are NOT encoded.
38
- // TOUCH = 0, // 00000000
39
- // // MapSchema Operations
40
- // CLEAR = 10,
41
- // }
42
- //# sourceMappingURL=spec.js.map
package/lib/spec.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"spec.js","sourceRoot":"","sources":["../src/spec.ts"],"names":[],"mappings":";;;AAAA,iGAAiG;AACpF,QAAA,mBAAmB,GAAG,GAAG,CAAC,CAAC,4DAA4D;AACvF,QAAA,OAAO,GAAG,GAAG,CAAC;AAE3B;;GAEG;AACH,IAAY,SAmBX;AAnBD,WAAY,SAAS;IACjB,8BAA8B;IAC9B,yCAAS,CAAA;IAET,8BAA8B;IAC9B,+CAAW,CAAA;IAEX,eAAe;IACf,8CAAW,CAAA;IAEX,mCAAmC;IACnC,+DAAoB,CAAA;IAEpB,yFAAyF;IACzF,2BAA2B;IAC3B,2CAAS,CAAA;IAET,uBAAuB;IACvB,4CAAU,CAAA;AACd,CAAC,EAnBW,SAAS,yBAAT,SAAS,QAmBpB;AAED,0BAA0B;AAC1B,qCAAqC;AACrC,eAAe;AACf,8BAA8B;AAE9B,qCAAqC;AACrC,8BAA8B;AAE9B,sBAAsB;AACtB,gCAAgC;AAEhC,0CAA0C;AAC1C,wCAAwC;AAExC,gGAAgG;AAChG,kCAAkC;AAClC,6BAA6B;AAE7B,8BAA8B;AAC9B,kBAAkB;AAClB,IAAI","sourcesContent":["// export const SWITCH_TO_STRUCTURE = 193; (easily collides with DELETE_AND_ADD + fieldIndex = 2)\nexport const SWITCH_TO_STRUCTURE = 255; // (decoding collides with DELETE_AND_ADD + fieldIndex = 63)\nexport const TYPE_ID = 213;\n\n/**\n * Encoding Schema field operations.\n */\nexport enum OPERATION {\n // add new structure/primitive\n ADD = 128,\n\n // replace structure/primitive\n REPLACE = 0,\n\n // delete field\n DELETE = 64,\n\n // DELETE field, followed by an ADD\n DELETE_AND_ADD = 192, // 11100000\n\n // TOUCH is used to determine hierarchy of nested Schema structures during serialization.\n // touches are NOT encoded.\n TOUCH = 1, // 00000000\n\n // MapSchema Operations\n CLEAR = 10,\n}\n\n// export enum OPERATION {\n// // add new structure/primitive\n// // (128)\n// ADD = 128, // 10000000,\n\n// // replace structure/primitive\n// REPLACE = 1,// 00000001\n\n// // delete field\n// DELETE = 192, // 11000000\n\n// // DELETE field, followed by an ADD\n// DELETE_AND_ADD = 224, // 11100000\n\n// // TOUCH is used to determine hierarchy of nested Schema structures during serialization.\n// // touches are NOT encoded.\n// TOUCH = 0, // 00000000\n\n// // MapSchema Operations\n// CLEAR = 10,\n// }"]}
@@ -1,238 +0,0 @@
1
- import { ChangeTree } from "../changes/ChangeTree";
2
- import { SchemaDecoderCallbacks } from "../Schema";
3
- import { DataChange } from "..";
4
- export declare function getArrayProxy(value: ArraySchema): ArraySchema<any>;
5
- export declare class ArraySchema<V = any> implements Array<V>, SchemaDecoderCallbacks {
6
- protected $changes: ChangeTree;
7
- protected $items: Map<number, V>;
8
- protected $indexes: Map<number, number>;
9
- protected $refId: number;
10
- [n: number]: V;
11
- $callbacks: {
12
- [operation: number]: Array<(item: V, key: number) => void>;
13
- };
14
- onAdd(callback: (item: V, key: number) => void, triggerAll?: boolean): () => boolean;
15
- onRemove(callback: (item: V, key: number) => void): () => boolean;
16
- onChange(callback: (item: V, key: number) => void): () => boolean;
17
- static is(type: any): boolean;
18
- constructor(...items: V[]);
19
- set length(value: number);
20
- get length(): number;
21
- push(...values: V[]): number;
22
- /**
23
- * Removes the last element from an array and returns it.
24
- */
25
- pop(): V | undefined;
26
- at(index: number): V;
27
- setAt(index: number, value: V): void;
28
- deleteAt(index: number): boolean;
29
- protected $deleteAt(index: any): boolean;
30
- clear(changes?: DataChange[]): void;
31
- /**
32
- * Combines two or more arrays.
33
- * @param items Additional items to add to the end of array1.
34
- */
35
- concat(...items: (V | ConcatArray<V>)[]): ArraySchema<V>;
36
- /**
37
- * Adds all the elements of an array separated by the specified separator string.
38
- * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
39
- */
40
- join(separator?: string): string;
41
- /**
42
- * Reverses the elements in an Array.
43
- */
44
- reverse(): ArraySchema<V>;
45
- /**
46
- * Removes the first element from an array and returns it.
47
- */
48
- shift(): V | undefined;
49
- /**
50
- * Returns a section of an array.
51
- * @param start The beginning of the specified portion of the array.
52
- * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
53
- */
54
- slice(start?: number, end?: number): V[];
55
- /**
56
- * Sorts an array.
57
- * @param compareFn Function used to determine the order of the elements. It is expected to return
58
- * a negative value if first argument is less than second argument, zero if they're equal and a positive
59
- * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
60
- * ```ts
61
- * [11,2,22,1].sort((a, b) => a - b)
62
- * ```
63
- */
64
- sort(compareFn?: (a: V, b: V) => number): this;
65
- /**
66
- * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
67
- * @param start The zero-based location in the array from which to start removing elements.
68
- * @param deleteCount The number of elements to remove.
69
- * @param items Elements to insert into the array in place of the deleted elements.
70
- */
71
- splice(start: number, deleteCount?: number, ...items: V[]): V[];
72
- /**
73
- * Inserts new elements at the start of an array.
74
- * @param items Elements to insert at the start of the Array.
75
- */
76
- unshift(...items: V[]): number;
77
- /**
78
- * Returns the index of the first occurrence of a value in an array.
79
- * @param searchElement The value to locate in the array.
80
- * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
81
- */
82
- indexOf(searchElement: V, fromIndex?: number): number;
83
- /**
84
- * Returns the index of the last occurrence of a specified value in an array.
85
- * @param searchElement The value to locate in the array.
86
- * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.
87
- */
88
- lastIndexOf(searchElement: V, fromIndex?: number): number;
89
- /**
90
- * Determines whether all the members of an array satisfy the specified test.
91
- * @param callbackfn A function that accepts up to three arguments. The every method calls
92
- * the callbackfn function for each element in the array until the callbackfn returns a value
93
- * which is coercible to the Boolean value false, or until the end of the array.
94
- * @param thisArg An object to which the this keyword can refer in the callbackfn function.
95
- * If thisArg is omitted, undefined is used as the this value.
96
- */
97
- every(callbackfn: (value: V, index: number, array: V[]) => unknown, thisArg?: any): boolean;
98
- /**
99
- * Determines whether the specified callback function returns true for any element of an array.
100
- * @param callbackfn A function that accepts up to three arguments. The some method calls
101
- * the callbackfn function for each element in the array until the callbackfn returns a value
102
- * which is coercible to the Boolean value true, or until the end of the array.
103
- * @param thisArg An object to which the this keyword can refer in the callbackfn function.
104
- * If thisArg is omitted, undefined is used as the this value.
105
- */
106
- some(callbackfn: (value: V, index: number, array: V[]) => unknown, thisArg?: any): boolean;
107
- /**
108
- * Performs the specified action for each element in an array.
109
- * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
110
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
111
- */
112
- forEach(callbackfn: (value: V, index: number, array: V[]) => void, thisArg?: any): void;
113
- /**
114
- * Calls a defined callback function on each element of an array, and returns an array that contains the results.
115
- * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
116
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
117
- */
118
- map<U>(callbackfn: (value: V, index: number, array: V[]) => U, thisArg?: any): U[];
119
- /**
120
- * Returns the elements of an array that meet the condition specified in a callback function.
121
- * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
122
- * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
123
- */
124
- filter(callbackfn: (value: V, index: number, array: V[]) => unknown, thisArg?: any): any;
125
- /**
126
- * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
127
- * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
128
- * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
129
- */
130
- reduce<U = V>(callbackfn: (previousValue: U, currentValue: V, currentIndex: number, array: V[]) => U, initialValue?: U): U;
131
- /**
132
- * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
133
- * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
134
- * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
135
- */
136
- reduceRight<U = V>(callbackfn: (previousValue: U, currentValue: V, currentIndex: number, array: V[]) => U, initialValue?: U): U;
137
- /**
138
- * Returns the value of the first element in the array where predicate is true, and undefined
139
- * otherwise.
140
- * @param predicate find calls predicate once for each element of the array, in ascending
141
- * order, until it finds one where predicate returns true. If such an element is found, find
142
- * immediately returns that element value. Otherwise, find returns undefined.
143
- * @param thisArg If provided, it will be used as the this value for each invocation of
144
- * predicate. If it is not provided, undefined is used instead.
145
- */
146
- find(predicate: (value: V, index: number, obj: V[]) => boolean, thisArg?: any): V | undefined;
147
- /**
148
- * Returns the index of the first element in the array where predicate is true, and -1
149
- * otherwise.
150
- * @param predicate find calls predicate once for each element of the array, in ascending
151
- * order, until it finds one where predicate returns true. If such an element is found,
152
- * findIndex immediately returns that element index. Otherwise, findIndex returns -1.
153
- * @param thisArg If provided, it will be used as the this value for each invocation of
154
- * predicate. If it is not provided, undefined is used instead.
155
- */
156
- findIndex(predicate: (value: V, index: number, obj: V[]) => unknown, thisArg?: any): number;
157
- /**
158
- * Returns the this object after filling the section identified by start and end with value
159
- * @param value value to fill array section with
160
- * @param start index to start filling the array at. If start is negative, it is treated as
161
- * length+start where length is the length of the array.
162
- * @param end index to stop filling the array at. If end is negative, it is treated as
163
- * length+end.
164
- */
165
- fill(value: V, start?: number, end?: number): this;
166
- /**
167
- * Returns the this object after copying a section of the array identified by start and end
168
- * to the same array starting at position target
169
- * @param target If target is negative, it is treated as length+target where length is the
170
- * length of the array.
171
- * @param start If start is negative, it is treated as length+start. If end is negative, it
172
- * is treated as length+end.
173
- * @param end If not specified, length of the this object is used as its default value.
174
- */
175
- copyWithin(target: number, start: number, end?: number): this;
176
- /**
177
- * Returns a string representation of an array.
178
- */
179
- toString(): string;
180
- /**
181
- * Returns a string representation of an array. The elements are converted to string using their toLocalString methods.
182
- */
183
- toLocaleString(): string;
184
- /** Iterator */
185
- [Symbol.iterator](): IterableIterator<V>;
186
- static get [Symbol.species](): typeof ArraySchema;
187
- [Symbol.unscopables]: any;
188
- /**
189
- * Returns an iterable of key, value pairs for every entry in the array
190
- */
191
- entries(): IterableIterator<[number, V]>;
192
- /**
193
- * Returns an iterable of keys in the array
194
- */
195
- keys(): IterableIterator<number>;
196
- /**
197
- * Returns an iterable of values in the array
198
- */
199
- values(): IterableIterator<V>;
200
- /**
201
- * Determines whether an array includes a certain element, returning true or false as appropriate.
202
- * @param searchElement The element to search for.
203
- * @param fromIndex The position in this array at which to begin searching for searchElement.
204
- */
205
- includes(searchElement: V, fromIndex?: number): boolean;
206
- /**
207
- * Calls a defined callback function on each element of an array. Then, flattens the result into
208
- * a new array.
209
- * This is identical to a map followed by flat with depth 1.
210
- *
211
- * @param callback A function that accepts up to three arguments. The flatMap method calls the
212
- * callback function one time for each element in the array.
213
- * @param thisArg An object to which the this keyword can refer in the callback function. If
214
- * thisArg is omitted, undefined is used as the this value.
215
- */
216
- flatMap<U, This = undefined>(callback: (this: This, value: V, index: number, array: V[]) => U | ReadonlyArray<U>, thisArg?: This): U[];
217
- /**
218
- * Returns a new array with all sub-array elements concatenated into it recursively up to the
219
- * specified depth.
220
- *
221
- * @param depth The maximum recursion depth
222
- */
223
- flat<A, D extends number = 1>(this: A, depth?: D): any;
224
- findLast(): any;
225
- findLastIndex(...args: any[]): any;
226
- with(index: number, value: V): ArraySchema<V>;
227
- toReversed(): V[];
228
- toSorted(compareFn?: (a: V, b: V) => number): V[];
229
- toSpliced(start: number, deleteCount: number, ...items: V[]): V[];
230
- toSpliced(start: number, deleteCount?: number): V[];
231
- protected setIndex(index: number, key: number): void;
232
- protected getIndex(index: number): number;
233
- protected getByIndex(index: number): V;
234
- protected deleteByIndex(index: number): void;
235
- toArray(): V[];
236
- toJSON(): any[];
237
- clone(isDecoding?: boolean): ArraySchema<V>;
238
- }