Skip to content

Commit

Permalink
apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacovCR committed Sep 10, 2024
1 parent b1daf03 commit 9654570
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/jsutils/instanceOf.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { inspect } from './inspect.js';

/* c8 ignore next 3 */
const isDevelopment =
globalThis.process != null &&
const isProduction =
globalThis.process == null ||
// eslint-disable-next-line no-undef
process.env.NODE_ENV === 'development';
(process.env.NODE_ENV !== 'development' &&
// eslint-disable-next-line no-undef
process.env.NODE_ENV !== 'test');

/**
* A replacement for instanceof which includes an error warning when multi-realm
Expand All @@ -13,8 +15,13 @@ const isDevelopment =
* See: https://webpack.js.org/guides/production/
*/
export const instanceOf: (value: unknown, constructor: Constructor) => boolean =
isDevelopment
/* c8 ignore next 6 */
// FIXME: https://github.com/graphql/graphql-js/issues/2317
isProduction
? function instanceOf(value: unknown, constructor: Constructor): boolean {
return value instanceof constructor;
}
: function instanceOf(value: unknown, constructor: Constructor): boolean {
if (value instanceof constructor) {
return true;
}
Expand Down Expand Up @@ -45,11 +52,6 @@ spurious results.`,
}
}
return false;
}
: /* c8 ignore next 4 */
// FIXME: https://github.com/graphql/graphql-js/issues/2317
function instanceOf(value: unknown, constructor: Constructor): boolean {
return value instanceof constructor;
};

interface Constructor extends Function {
Expand Down

0 comments on commit 9654570

Please sign in to comment.