File tree Expand file tree Collapse file tree 6 files changed +9
-39
lines changed Expand file tree Collapse file tree 6 files changed +9
-39
lines changed Original file line number Diff line number Diff line change 1
- import find from '../polyfills/find' ;
2
-
3
1
import type { ObjMap } from '../jsutils/ObjMap' ;
4
2
import keyMap from '../jsutils/keyMap' ;
5
3
import inspect from '../jsutils/inspect' ;
@@ -249,12 +247,10 @@ export function getDirectiveValues(
249
247
node : { + directives ?: $ReadOnlyArray < DirectiveNode > , ... } ,
250
248
variableValues ?: ?ObjMap < mixed > ,
251
249
) : void | { [ argument : string ] : mixed , ... } {
252
- const directiveNode =
253
- node . directives &&
254
- find (
255
- node . directives ,
256
- ( directive ) => directive . name . value === directiveDef . name ,
257
- ) ;
250
+ // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
251
+ const directiveNode = node . directives ?. find (
252
+ ( directive ) => directive . name . value === directiveDef . name ,
253
+ ) ;
258
254
259
255
if ( directiveNode ) {
260
256
return getArgumentValues ( directiveDef , directiveNode , variableValues ) ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- import find from '../polyfills/find' ;
2
1
import arrayFrom from '../polyfills/arrayFrom' ;
3
2
import objectValues from '../polyfills/objectValues' ;
4
3
import { SYMBOL_TO_STRING_TAG } from '../polyfills/symbols' ;
@@ -329,7 +328,7 @@ export class GraphQLSchema {
329
328
}
330
329
331
330
getDirective ( name : string ) : ?GraphQLDirective {
332
- return find ( this . getDirectives ( ) , ( directive ) => directive . name === name ) ;
331
+ return this . getDirectives ( ) . find ( ( directive ) => directive . name === name ) ;
333
332
}
334
333
335
334
toConfig ( ) : GraphQLSchemaNormalizedConfig {
Original file line number Diff line number Diff line change 1
- import find from '../polyfills/find' ;
2
1
import objectValues from '../polyfills/objectValues' ;
3
2
4
3
import inspect from '../jsutils/inspect' ;
@@ -393,7 +392,7 @@ function validateTypeImplementsInterface(
393
392
// Assert each interface field arg is implemented.
394
393
for ( const ifaceArg of ifaceField . args ) {
395
394
const argName = ifaceArg . name ;
396
- const typeArg = find ( typeField . args , ( arg ) => arg . name === argName ) ;
395
+ const typeArg = typeField . args . find ( ( arg ) => arg . name === argName ) ;
397
396
398
397
// Assert interface field arg exists on object field.
399
398
if ( ! typeArg ) {
@@ -428,7 +427,7 @@ function validateTypeImplementsInterface(
428
427
// Assert additional arguments must not be required.
429
428
for ( const typeArg of typeField . args ) {
430
429
const argName = typeArg . name ;
431
- const ifaceArg = find ( ifaceField . args , ( arg ) => arg . name === argName ) ;
430
+ const ifaceArg = ifaceField . args . find ( ( arg ) => arg . name === argName ) ;
432
431
if ( ! ifaceArg && isRequiredArgument ( typeArg ) ) {
433
432
context . reportError (
434
433
`Object field ${ type . name } .${ fieldName } includes required argument ${ argName } that is missing from the Interface field ${ iface . name } .${ fieldName } .` ,
Original file line number Diff line number Diff line change 1
- import find from '../polyfills/find' ;
2
-
3
1
import type { Visitor } from '../language/visitor' ;
4
2
import type { ASTNode , ASTKindToNode , FieldNode } from '../language/ast' ;
5
3
import { Kind } from '../language/kinds' ;
@@ -204,8 +202,7 @@ export class TypeInfo {
204
202
let argType : mixed ;
205
203
const fieldOrDirective = this . getDirective ( ) ?? this . getFieldDef ( ) ;
206
204
if ( fieldOrDirective ) {
207
- argDef = find (
208
- fieldOrDirective . args ,
205
+ argDef = fieldOrDirective . args . find (
209
206
( arg ) => arg . name === node . name . value ,
210
207
) ;
211
208
if ( argDef ) {
Original file line number Diff line number Diff line change 1
- import find from '../../polyfills/find' ;
2
1
import objectEntries from '../../polyfills/objectEntries' ;
3
2
4
3
import type { ObjMap } from '../../jsutils/ObjMap' ;
@@ -631,8 +630,7 @@ function sameArguments(
631
630
return false ;
632
631
}
633
632
return arguments1 . every ( ( argument1 ) => {
634
- const argument2 = find (
635
- arguments2 ,
633
+ const argument2 = arguments2 . find (
636
634
( argument ) => argument . name . value === argument1 . name . value ,
637
635
) ;
638
636
if ( ! argument2 ) {
You can’t perform that action at this time.
0 commit comments