@@ -710,7 +710,7 @@ declare interface Generator<T> {
710
710
}
711
711
712
712
* append ( element : T ) : IEnumerable < T > {
713
- for ( const item of this ) yield item
713
+ yield * this
714
714
yield element
715
715
}
716
716
@@ -731,8 +731,8 @@ declare interface Generator<T> {
731
731
}
732
732
733
733
* concat ( source : IEnumerable < T > ) : IEnumerable < T > {
734
- for ( const item of this ) yield item
735
- for ( const item of source ) yield item
734
+ yield * this
735
+ yield * source
736
736
}
737
737
738
738
contains ( value : T ) : boolean ;
@@ -763,7 +763,7 @@ declare interface Generator<T> {
763
763
stack . push ( item )
764
764
}
765
765
}
766
- for ( const item of stack ) yield item
766
+ yield * stack
767
767
}
768
768
769
769
distinctBy < TKey > ( keySelector : ( item : T ) => TKey ) : IEnumerable < T > ;
@@ -778,7 +778,7 @@ declare interface Generator<T> {
778
778
stack . push ( item )
779
779
}
780
780
}
781
- for ( const item of stack ) yield item
781
+ yield * stack
782
782
}
783
783
784
784
elementAt ( index : number ) : T {
@@ -995,9 +995,7 @@ declare interface Generator<T> {
995
995
order ( ) : IEnumerable < T > ;
996
996
order ( comparer : ( current : T , exist : T ) => number ) : IEnumerable < T > ;
997
997
* order ( comparer ? : ( current : T , exist : T ) => number ) : IEnumerable < T > {
998
- comparer ??= (
999
- left ,
1000
- right ) => left as any - ( right as any )
998
+ comparer ??= ( left , right ) => left as any - ( right as any )
1001
999
const stack = [ ]
1002
1000
for ( const item of this ) {
1003
1001
const index = stack . findIndex ( ( x : any ) => comparer ( item , x ) <= 0 )
@@ -1007,6 +1005,7 @@ declare interface Generator<T> {
1007
1005
stack . splice ( index , 0 , item )
1008
1006
}
1009
1007
}
1008
+ yield * stack
1010
1009
}
1011
1010
1012
1011
orderBy < TKey > ( keySelector : ( item : T ) => TKey ) : IEnumerable < T > ;
@@ -1028,7 +1027,7 @@ declare interface Generator<T> {
1028
1027
stack . splice ( index , 0 , item )
1029
1028
}
1030
1029
}
1031
- for ( const item of stack ) yield item
1030
+ yield * stack
1032
1031
}
1033
1032
1034
1033
orderByDescending < TKey > ( keySelector : ( item : T ) => TKey ) : IEnumerable < T > ;
@@ -1050,7 +1049,7 @@ declare interface Generator<T> {
1050
1049
stack . splice ( index , 0 , item )
1051
1050
}
1052
1051
}
1053
- for ( const item of stack ) yield item
1052
+ yield * stack
1054
1053
}
1055
1054
1056
1055
orderDescending ( ) : IEnumerable < T > ;
@@ -1068,12 +1067,12 @@ declare interface Generator<T> {
1068
1067
stack . splice ( index , 0 , item )
1069
1068
}
1070
1069
}
1071
- for ( const item of stack ) yield item
1070
+ yield * stack
1072
1071
}
1073
1072
1074
1073
* prepend ( element : T ) : IEnumerable < T > {
1075
1074
yield element ;
1076
- for ( const item of this ) yield item
1075
+ yield * this
1077
1076
}
1078
1077
1079
1078
* reverse ( ) : IEnumerable < T > {
@@ -1206,9 +1205,7 @@ declare interface Generator<T> {
1206
1205
stack . shift ( )
1207
1206
}
1208
1207
}
1209
- for ( const item of stack ) {
1210
- yield item
1211
- }
1208
+ yield * stack
1212
1209
}
1213
1210
1214
1211
takeWhile ( predicate : ( item : T ) => boolean ) : IEnumerable < T > ;
@@ -1260,9 +1257,7 @@ declare interface Generator<T> {
1260
1257
union . push ( item )
1261
1258
}
1262
1259
}
1263
- for ( const item of union ) {
1264
- yield item
1265
- }
1260
+ yield * union
1266
1261
}
1267
1262
1268
1263
* unionBy < TKey > (
@@ -1282,9 +1277,7 @@ declare interface Generator<T> {
1282
1277
union . push ( item )
1283
1278
}
1284
1279
}
1285
- for ( const item of union ) {
1286
- yield item
1287
- }
1280
+ yield * union
1288
1281
}
1289
1282
1290
1283
@@ -1301,7 +1294,7 @@ declare interface Generator<T> {
1301
1294
1302
1295
class PartialArrayLike < T > extends Enumerable < T > {
1303
1296
* asEnumerable ( ) : IEnumerable < T > {
1304
- for ( const item of this ) yield item ;
1297
+ yield * this
1305
1298
}
1306
1299
}
1307
1300
@@ -1319,7 +1312,7 @@ declare interface Generator<T> {
1319
1312
}
1320
1313
1321
1314
* asEnumerable ( ) : IEnumerable < T > {
1322
- for ( const item of this ) yield item ;
1315
+ yield * this
1323
1316
}
1324
1317
1325
1318
clear ( ) : void {
0 commit comments