summaryrefslogtreecommitdiff
path: root/school/node_modules/graphql/jsutils/defineInspect.mjs
blob: 33f6fdbd655be476e3f3d51ae6dd9ca7d5c8bfae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import invariant from "./invariant.mjs";
import nodejsCustomInspectSymbol from "./nodejsCustomInspectSymbol.mjs";
/**
 * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON`
 */

export default function defineInspect(classObject) {
  var fn = classObject.prototype.toJSON;
  typeof fn === 'function' || invariant(0);
  classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317')

  if (nodejsCustomInspectSymbol) {
    classObject.prototype[nodejsCustomInspectSymbol] = fn;
  }
}