UNPKG

1.39 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = instanceOf;
7
8
9// eslint-disable-next-line no-redeclare
10function instanceOf(value, constructor) {
11 if (value instanceof constructor) {
12 return true;
13 }
14 if (value) {
15 var valueConstructor = value.constructor;
16 if (valueConstructor && valueConstructor.name === constructor.name) {
17 throw new Error("Cannot use " + constructor.name + " \"" + value + "\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.");
18 }
19 }
20 return false;
21} /**
22 * Copyright (c) 2015-present, Facebook, Inc.
23 *
24 * This source code is licensed under the MIT license found in the
25 * LICENSE file in the root directory of this source tree.
26 *
27 *
28 */
29
30/**
31 * A replacement for instanceof which includes an error warning when multi-realm
32 * constructors are detected.
33 */
\No newline at end of file