@@ -8,6 +8,20 @@ export class Int8Array extends TypedArray<i8,i32> {
8
8
subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Int8Array {
9
9
return changetype < Int8Array > ( super . subarray ( begin , end ) ) ;
10
10
}
11
+
12
+ reduce < ReturnType > (
13
+ callbackfn : ( accumulator : ReturnType , value : i8 , index : i32 , array : Int8Array ) => ReturnType ,
14
+ initialValue : ReturnType ,
15
+ ) : ReturnType {
16
+ return super . reduce_internal < Int8Array , ReturnType > ( callbackfn , this , initialValue ) ;
17
+ }
18
+
19
+ reduceRight < ReturnType > (
20
+ callbackfn : ( accumulator : ReturnType , value : i8 , index : i32 , array : Int8Array ) => ReturnType ,
21
+ initialValue : ReturnType ,
22
+ ) : ReturnType {
23
+ return super . reduce_internal < Int8Array , ReturnType > ( callbackfn , this , initialValue , true ) ;
24
+ }
11
25
}
12
26
13
27
export class Uint8Array extends TypedArray < u8 , u32 > {
@@ -16,6 +30,20 @@ export class Uint8Array extends TypedArray<u8,u32> {
16
30
subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Uint8Array {
17
31
return changetype < Uint8Array > ( super . subarray ( begin , end ) ) ;
18
32
}
33
+
34
+ reduce < ReturnType > (
35
+ callbackfn : ( accumulator : ReturnType , value : u8 , index : i32 , array : Uint8Array ) => ReturnType ,
36
+ initialValue : ReturnType ,
37
+ ) : ReturnType {
38
+ return super . reduce_internal < Uint8Array , ReturnType > ( callbackfn , this , initialValue ) ;
39
+ }
40
+
41
+ reduceRight < ReturnType > (
42
+ callbackfn : ( accumulator : ReturnType , value : u8 , index : i32 , array : Uint8Array ) => ReturnType ,
43
+ initialValue : ReturnType ,
44
+ ) : ReturnType {
45
+ return super . reduce_internal < Uint8Array , ReturnType > ( callbackfn , this , initialValue , true ) ;
46
+ }
19
47
}
20
48
21
49
export class Uint8ClampedArray extends TypedArray < u8 , u32 > {
@@ -34,6 +62,20 @@ export class Uint8ClampedArray extends TypedArray<u8,u32> {
34
62
subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Uint8ClampedArray {
35
63
return changetype < Uint8ClampedArray > ( super . subarray ( begin , end ) ) ;
36
64
}
65
+
66
+ reduce < ReturnType > (
67
+ callbackfn : ( accumulator : ReturnType , value : u8 , index : i32 , array : Uint8ClampedArray ) => ReturnType ,
68
+ initialValue : ReturnType ,
69
+ ) : ReturnType {
70
+ return super . reduce_internal < Uint8ClampedArray , ReturnType > ( callbackfn , this , initialValue ) ;
71
+ }
72
+
73
+ reduceRight < ReturnType > (
74
+ callbackfn : ( accumulator : ReturnType , value : u8 , index : i32 , array : Uint8ClampedArray ) => ReturnType ,
75
+ initialValue : ReturnType ,
76
+ ) : ReturnType {
77
+ return super . reduce_internal < Uint8ClampedArray , ReturnType > ( callbackfn , this , initialValue , true ) ;
78
+ }
37
79
}
38
80
39
81
export class Int16Array extends TypedArray < i16 , i32 > {
@@ -42,6 +84,20 @@ export class Int16Array extends TypedArray<i16,i32> {
42
84
subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Int16Array {
43
85
return changetype < Int16Array > ( super . subarray ( begin , end ) ) ;
44
86
}
87
+
88
+ reduce < ReturnType > (
89
+ callbackfn : ( accumulator : ReturnType , value : i16 , index : i32 , array : Int16Array ) => ReturnType ,
90
+ initialValue : ReturnType ,
91
+ ) : ReturnType {
92
+ return super . reduce_internal < Int16Array , ReturnType > ( callbackfn , this , initialValue ) ;
93
+ }
94
+
95
+ reduceRight < ReturnType > (
96
+ callbackfn : ( accumulator : ReturnType , value : i16 , index : i32 , array : Int16Array ) => ReturnType ,
97
+ initialValue : ReturnType ,
98
+ ) : ReturnType {
99
+ return super . reduce_internal < Int16Array , ReturnType > ( callbackfn , this , initialValue , true ) ;
100
+ }
45
101
}
46
102
47
103
export class Uint16Array extends TypedArray < u16 , u32 > {
@@ -50,6 +106,20 @@ export class Uint16Array extends TypedArray<u16,u32> {
50
106
subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Uint16Array {
51
107
return changetype < Uint16Array > ( super . subarray ( begin , end ) ) ;
52
108
}
109
+
110
+ reduce < ReturnType > (
111
+ callbackfn : ( accumulator : ReturnType , value : u16 , index : i32 , array : Uint16Array ) => ReturnType ,
112
+ initialValue : ReturnType ,
113
+ ) : ReturnType {
114
+ return super . reduce_internal < Uint16Array , ReturnType > ( callbackfn , this , initialValue ) ;
115
+ }
116
+
117
+ reduceRight < ReturnType > (
118
+ callbackfn : ( accumulator : ReturnType , value : u16 , index : i32 , array : Uint16Array ) => ReturnType ,
119
+ initialValue : ReturnType ,
120
+ ) : ReturnType {
121
+ return super . reduce_internal < Uint16Array , ReturnType > ( callbackfn , this , initialValue , true ) ;
122
+ }
53
123
}
54
124
55
125
export class Int32Array extends TypedArray < i32 , i32 > {
@@ -58,6 +128,24 @@ export class Int32Array extends TypedArray<i32,i32> {
58
128
subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Int32Array {
59
129
return changetype < Int32Array > ( super . subarray ( begin , end ) ) ;
60
130
}
131
+
132
+ /**
133
+ * @param callbackfn {function} - a function that reduces each value to a ReturnType
134
+ * @param initialValue {ReturnType} - the initial ReturnType value to be passed to the callbackfn
135
+ */
136
+ reduce < ReturnType > (
137
+ callbackfn : ( accumulator : ReturnType , value : i32 , index : i32 , array : Int32Array ) => ReturnType ,
138
+ initialValue : ReturnType ,
139
+ ) : ReturnType {
140
+ return super . reduce_internal < Int32Array , ReturnType > ( callbackfn , this , initialValue ) ;
141
+ }
142
+
143
+ reduceRight < ReturnType > (
144
+ callbackfn : ( accumulator : ReturnType , value : i32 , index : i32 , array : Int32Array ) => ReturnType ,
145
+ initialValue : ReturnType ,
146
+ ) : ReturnType {
147
+ return super . reduce_internal < Int32Array , ReturnType > ( callbackfn , this , initialValue , true ) ;
148
+ }
61
149
}
62
150
63
151
export class Uint32Array extends TypedArray < u32 , u32 > {
@@ -66,6 +154,20 @@ export class Uint32Array extends TypedArray<u32,u32> {
66
154
subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Uint32Array {
67
155
return changetype < Uint32Array > ( super . subarray ( begin , end ) ) ;
68
156
}
157
+
158
+ reduce < ReturnType > (
159
+ callbackfn : ( accumulator : ReturnType , value : u32 , index : i32 , array : Uint32Array ) => ReturnType ,
160
+ initialValue : ReturnType ,
161
+ ) : ReturnType {
162
+ return super . reduce_internal < Uint32Array , ReturnType > ( callbackfn , this , initialValue ) ;
163
+ }
164
+
165
+ reduceRight < ReturnType > (
166
+ callbackfn : ( accumulator : ReturnType , value : u32 , index : i32 , array : Uint32Array ) => ReturnType ,
167
+ initialValue : ReturnType ,
168
+ ) : ReturnType {
169
+ return super . reduce_internal < Uint32Array , ReturnType > ( callbackfn , this , initialValue , true ) ;
170
+ }
69
171
}
70
172
71
173
export class Int64Array extends TypedArray < i64 , i64 > {
@@ -74,6 +176,20 @@ export class Int64Array extends TypedArray<i64,i64> {
74
176
subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Int64Array {
75
177
return changetype < Int64Array > ( super . subarray ( begin , end ) ) ;
76
178
}
179
+
180
+ reduce < ReturnType > (
181
+ callbackfn : ( accumulator : ReturnType , value : i64 , index : i32 , array : Int64Array ) => ReturnType ,
182
+ initialValue : ReturnType ,
183
+ ) : ReturnType {
184
+ return super . reduce_internal < Int64Array , ReturnType > ( callbackfn , this , initialValue ) ;
185
+ }
186
+
187
+ reduceRight < ReturnType > (
188
+ callbackfn : ( accumulator : ReturnType , value : i64 , index : i32 , array : Int64Array ) => ReturnType ,
189
+ initialValue : ReturnType ,
190
+ ) : ReturnType {
191
+ return super . reduce_internal < Int64Array , ReturnType > ( callbackfn , this , initialValue , true ) ;
192
+ }
77
193
}
78
194
79
195
export class Uint64Array extends TypedArray < u64 , u64 > {
@@ -82,6 +198,20 @@ export class Uint64Array extends TypedArray<u64,u64> {
82
198
subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Uint64Array {
83
199
return changetype < Uint64Array > ( super . subarray ( begin , end ) ) ;
84
200
}
201
+
202
+ reduce < ReturnType > (
203
+ callbackfn : ( accumulator : ReturnType , value : u64 , index : i32 , array : Uint64Array ) => ReturnType ,
204
+ initialValue : ReturnType ,
205
+ ) : ReturnType {
206
+ return super . reduce_internal < Uint64Array , ReturnType > ( callbackfn , this , initialValue ) ;
207
+ }
208
+
209
+ reduceRight < ReturnType > (
210
+ callbackfn : ( accumulator : ReturnType , value : u64 , index : i32 , array : Uint64Array ) => ReturnType ,
211
+ initialValue : ReturnType ,
212
+ ) : ReturnType {
213
+ return super . reduce_internal < Uint64Array , ReturnType > ( callbackfn , this , initialValue , true ) ;
214
+ }
85
215
}
86
216
87
217
export class Float32Array extends TypedArray < f32 , f32 > {
@@ -90,6 +220,20 @@ export class Float32Array extends TypedArray<f32,f32> {
90
220
subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Float32Array {
91
221
return changetype < Float32Array > ( super . subarray ( begin , end ) ) ;
92
222
}
223
+
224
+ reduce < ReturnType > (
225
+ callbackfn : ( accumulator : ReturnType , value : f32 , index : i32 , array : Float32Array ) => ReturnType ,
226
+ initialValue : ReturnType ,
227
+ ) : ReturnType {
228
+ return super . reduce_internal < Float32Array , ReturnType > ( callbackfn , this , initialValue ) ;
229
+ }
230
+
231
+ reduceRight < ReturnType > (
232
+ callbackfn : ( accumulator : ReturnType , value : f32 , index : i32 , array : Float32Array ) => ReturnType ,
233
+ initialValue : ReturnType ,
234
+ ) : ReturnType {
235
+ return super . reduce_internal < Float32Array , ReturnType > ( callbackfn , this , initialValue , true ) ;
236
+ }
93
237
}
94
238
95
239
export class Float64Array extends TypedArray < f64 , f64 > {
@@ -98,4 +242,18 @@ export class Float64Array extends TypedArray<f64,f64> {
98
242
subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Float64Array {
99
243
return changetype < Float64Array > ( super . subarray ( begin , end ) ) ;
100
244
}
245
+
246
+ reduce < ReturnType > (
247
+ callbackfn : ( accumulator : ReturnType , value : f64 , index : i32 , array : Float64Array ) => ReturnType ,
248
+ initialValue : ReturnType ,
249
+ ) : ReturnType {
250
+ return super . reduce_internal < Float64Array , ReturnType > ( callbackfn , this , initialValue ) ;
251
+ }
252
+
253
+ reduceRight < ReturnType > (
254
+ callbackfn : ( accumulator : ReturnType , value : f64 , index : i32 , array : Float64Array ) => ReturnType ,
255
+ initialValue : ReturnType ,
256
+ ) : ReturnType {
257
+ return super . reduce_internal < Float64Array , ReturnType > ( callbackfn , this , initialValue , true ) ;
258
+ }
101
259
}
0 commit comments