Skip to content

Commit 9654570

Browse files
committed
apply review suggestions
1 parent b1daf03 commit 9654570

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/jsutils/instanceOf.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { inspect } from './inspect.js';
22

33
/* c8 ignore next 3 */
4-
const isDevelopment =
5-
globalThis.process != null &&
4+
const isProduction =
5+
globalThis.process == null ||
66
// eslint-disable-next-line no-undef
7-
process.env.NODE_ENV === 'development';
7+
(process.env.NODE_ENV !== 'development' &&
8+
// eslint-disable-next-line no-undef
9+
process.env.NODE_ENV !== 'test');
810

911
/**
1012
* A replacement for instanceof which includes an error warning when multi-realm
@@ -13,8 +15,13 @@ const isDevelopment =
1315
* See: https://webpack.js.org/guides/production/
1416
*/
1517
export const instanceOf: (value: unknown, constructor: Constructor) => boolean =
16-
isDevelopment
18+
/* c8 ignore next 6 */
19+
// FIXME: https://github.com/graphql/graphql-js/issues/2317
20+
isProduction
1721
? function instanceOf(value: unknown, constructor: Constructor): boolean {
22+
return value instanceof constructor;
23+
}
24+
: function instanceOf(value: unknown, constructor: Constructor): boolean {
1825
if (value instanceof constructor) {
1926
return true;
2027
}
@@ -45,11 +52,6 @@ spurious results.`,
4552
}
4653
}
4754
return false;
48-
}
49-
: /* c8 ignore next 4 */
50-
// FIXME: https://github.com/graphql/graphql-js/issues/2317
51-
function instanceOf(value: unknown, constructor: Constructor): boolean {
52-
return value instanceof constructor;
5355
};
5456

5557
interface Constructor extends Function {

0 commit comments

Comments
 (0)