@@ -281,8 +281,7 @@ export function buildExecutionContext(
281
281
let operation : OperationDefinitionNode | void ;
282
282
let hasMultipleAssumedOperations = false ;
283
283
const fragments : ObjMap < FragmentDefinitionNode > = Object . create ( null ) ;
284
- for ( let i = 0 ; i < document . definitions . length ; i ++ ) {
285
- const definition = document . definitions [ i ] ;
284
+ for ( const definition of document . definitions ) {
286
285
switch ( definition . kind ) {
287
286
case Kind . OPERATION_DEFINITION :
288
287
if ( ! operationName && operation ) {
@@ -434,8 +433,7 @@ function executeFields(
434
433
const results = Object . create ( null ) ;
435
434
let containsPromise = false ;
436
435
437
- for ( let i = 0 , keys = Object . keys ( fields ) ; i < keys . length ; ++ i ) {
438
- const responseName = keys [ i ] ;
436
+ for ( const responseName of Object . keys ( fields ) ) {
439
437
const fieldNodes = fields [ responseName ] ;
440
438
const fieldPath = addPath ( path , responseName ) ;
441
439
const result = resolveField (
@@ -480,8 +478,7 @@ export function collectFields(
480
478
fields : ObjMap < Array < FieldNode > > ,
481
479
visitedFragmentNames : ObjMap < boolean > ,
482
480
): ObjMap< Array < FieldNode > > {
483
- for ( let i = 0 ; i < selectionSet . selections . length ; i ++ ) {
484
- const selection = selectionSet . selections [ i ] ;
481
+ for ( const selection of selectionSet . selections ) {
485
482
switch ( selection . kind ) {
486
483
case Kind . FIELD : {
487
484
if ( ! shouldIncludeNode ( exeContext , selection ) ) {
@@ -1108,13 +1105,12 @@ function _collectSubfields(
1108
1105
) : ObjMap < Array < FieldNode > > {
1109
1106
let subFieldNodes = Object . create ( null ) ;
1110
1107
const visitedFragmentNames = Object . create ( null ) ;
1111
- for ( let i = 0 ; i < fieldNodes . length ; i ++ ) {
1112
- const selectionSet = fieldNodes [ i ] . selectionSet ;
1113
- if ( selectionSet ) {
1108
+ for ( const node of fieldNodes ) {
1109
+ if ( node . selectionSet ) {
1114
1110
subFieldNodes = collectFields (
1115
1111
exeContext ,
1116
1112
returnType ,
1117
- selectionSet ,
1113
+ node . selectionSet ,
1118
1114
subFieldNodes ,
1119
1115
visitedFragmentNames ,
1120
1116
) ;
0 commit comments