@@ -5,7 +5,6 @@ import objectValues from '../polyfills/objectValues';
5
5
import keyMap from '../jsutils/keyMap' ;
6
6
import inspect from '../jsutils/inspect' ;
7
7
import invariant from '../jsutils/invariant' ;
8
- import isInvalid from '../jsutils/isInvalid' ;
9
8
import { type ObjMap } from '../jsutils/ObjMap' ;
10
9
11
10
import { Kind } from '../language/kinds' ;
@@ -52,7 +51,7 @@ export function valueFromAST(
52
51
53
52
if ( valueNode . kind === Kind . VARIABLE ) {
54
53
const variableName = valueNode . name . value ;
55
- if ( ! variables || isInvalid ( variables [ variableName ] ) ) {
54
+ if ( variables == null || variables [ variableName ] === undefined ) {
56
55
// No valid return value.
57
56
return ;
58
57
}
@@ -92,7 +91,7 @@ export function valueFromAST(
92
91
coercedValues . push ( null ) ;
93
92
} else {
94
93
const itemValue = valueFromAST ( itemNode , itemType, variables ) ;
95
- if ( isInvalid ( itemValue ) ) {
94
+ if ( itemValue === undefined ) {
96
95
return ; // Invalid: intentionally return no value.
97
96
}
98
97
coercedValues . push ( itemValue ) ;
@@ -101,7 +100,7 @@ export function valueFromAST(
101
100
return coercedValues ;
102
101
}
103
102
const coercedValue = valueFromAST ( valueNode , itemType , variables ) ;
104
- if ( isInvalid ( coercedValue ) ) {
103
+ if ( coercedValue === undefined ) {
105
104
return ; // Invalid: intentionally return no value.
106
105
}
107
106
return [ coercedValue ] ;
@@ -124,7 +123,7 @@ export function valueFromAST(
124
123
continue ;
125
124
}
126
125
const fieldValue = valueFromAST ( fieldNode . value , field . type , variables ) ;
127
- if ( isInvalid ( fieldValue ) ) {
126
+ if ( fieldValue === undefined ) {
128
127
return ; // Invalid: intentionally return no value.
129
128
}
130
129
coercedObj [ field . name ] = fieldValue ;
@@ -157,6 +156,6 @@ export function valueFromAST(
157
156
function isMissingVariable ( valueNode , variables ) {
158
157
return (
159
158
valueNode . kind === Kind . VARIABLE &&
160
- ( ! variables || isInvalid ( variables [ valueNode . name . value ] ) )
159
+ ( variables == null || variables [ valueNode . name . value ] === undefined )
161
160
) ;
162
161
}
0 commit comments