@@ -8,6 +8,20 @@ export class Int8Array extends TypedArray<i8,i32> {
88 subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Int8Array {
99 return changetype < Int8Array > ( super . subarray ( begin , end ) ) ;
1010 }
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+ }
1125}
1226
1327export class Uint8Array extends TypedArray < u8 , u32 > {
@@ -16,6 +30,20 @@ export class Uint8Array extends TypedArray<u8,u32> {
1630 subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Uint8Array {
1731 return changetype < Uint8Array > ( super . subarray ( begin , end ) ) ;
1832 }
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+ }
1947}
2048
2149export class Uint8ClampedArray extends TypedArray < u8 , u32 > {
@@ -34,6 +62,20 @@ export class Uint8ClampedArray extends TypedArray<u8,u32> {
3462 subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Uint8ClampedArray {
3563 return changetype < Uint8ClampedArray > ( super . subarray ( begin , end ) ) ;
3664 }
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+ }
3779}
3880
3981export class Int16Array extends TypedArray < i16 , i32 > {
@@ -42,6 +84,20 @@ export class Int16Array extends TypedArray<i16,i32> {
4284 subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Int16Array {
4385 return changetype < Int16Array > ( super . subarray ( begin , end ) ) ;
4486 }
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+ }
45101}
46102
47103export class Uint16Array extends TypedArray < u16 , u32 > {
@@ -50,6 +106,20 @@ export class Uint16Array extends TypedArray<u16,u32> {
50106 subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Uint16Array {
51107 return changetype < Uint16Array > ( super . subarray ( begin , end ) ) ;
52108 }
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+ }
53123}
54124
55125export class Int32Array extends TypedArray < i32 , i32 > {
@@ -58,6 +128,24 @@ export class Int32Array extends TypedArray<i32,i32> {
58128 subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Int32Array {
59129 return changetype < Int32Array > ( super . subarray ( begin , end ) ) ;
60130 }
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+ }
61149}
62150
63151export class Uint32Array extends TypedArray < u32 , u32 > {
@@ -66,6 +154,20 @@ export class Uint32Array extends TypedArray<u32,u32> {
66154 subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Uint32Array {
67155 return changetype < Uint32Array > ( super . subarray ( begin , end ) ) ;
68156 }
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+ }
69171}
70172
71173export class Int64Array extends TypedArray < i64 , i64 > {
@@ -74,6 +176,20 @@ export class Int64Array extends TypedArray<i64,i64> {
74176 subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Int64Array {
75177 return changetype < Int64Array > ( super . subarray ( begin , end ) ) ;
76178 }
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+ }
77193}
78194
79195export class Uint64Array extends TypedArray < u64 , u64 > {
@@ -82,6 +198,20 @@ export class Uint64Array extends TypedArray<u64,u64> {
82198 subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Uint64Array {
83199 return changetype < Uint64Array > ( super . subarray ( begin , end ) ) ;
84200 }
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+ }
85215}
86216
87217export class Float32Array extends TypedArray < f32 , f32 > {
@@ -90,6 +220,20 @@ export class Float32Array extends TypedArray<f32,f32> {
90220 subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Float32Array {
91221 return changetype < Float32Array > ( super . subarray ( begin , end ) ) ;
92222 }
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+ }
93237}
94238
95239export class Float64Array extends TypedArray < f64 , f64 > {
@@ -98,4 +242,18 @@ export class Float64Array extends TypedArray<f64,f64> {
98242 subarray ( begin : i32 = 0 , end : i32 = 0x7fffffff ) : Float64Array {
99243 return changetype < Float64Array > ( super . subarray ( begin , end ) ) ;
100244 }
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+ }
101259}
0 commit comments