-
Notifications
You must be signed in to change notification settings - Fork 2.1k
instanceOf: disable dev instanceOf checks if NODE_ENV not set #4188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,10 @@ | ||
| import { inspect } from './inspect.js'; | ||
|
|
||
| /* c8 ignore next 3 */ | ||
| const isProduction = | ||
| const isDevelopment = | ||
| globalThis.process != null && | ||
| // eslint-disable-next-line no-undef | ||
| process.env.NODE_ENV === 'production'; | ||
| process.env.NODE_ENV === 'development'; | ||
|
||
|
|
||
| /** | ||
| * A replacement for instanceof which includes an error warning when multi-realm | ||
|
|
@@ -13,13 +13,8 @@ const isProduction = | |
| * See: https://webpack.js.org/guides/production/ | ||
| */ | ||
| export const instanceOf: (value: unknown, constructor: Constructor) => boolean = | ||
| /* c8 ignore next 6 */ | ||
| // FIXME: https://github.com/graphql/graphql-js/issues/2317 | ||
| isProduction | ||
| isDevelopment | ||
| ? function instanceOf(value: unknown, constructor: Constructor): boolean { | ||
| return value instanceof constructor; | ||
| } | ||
| : function instanceOf(value: unknown, constructor: Constructor): boolean { | ||
| if (value instanceof constructor) { | ||
| return true; | ||
| } | ||
|
|
@@ -50,6 +45,11 @@ 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 { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.