1 | import invariant from "./invariant.mjs";
|
2 | import nodejsCustomInspectSymbol from "./nodejsCustomInspectSymbol.mjs";
|
3 | /**
|
4 | * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON`
|
5 | */
|
6 |
|
7 | export default function defineInspect(classObject) {
|
8 | var fn = classObject.prototype.toJSON;
|
9 | typeof fn === 'function' || invariant(0);
|
10 | classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317')
|
11 |
|
12 | if (nodejsCustomInspectSymbol) {
|
13 | classObject.prototype[nodejsCustomInspectSymbol] = fn;
|
14 | }
|
15 | }
|