swc/crates/swc_bundler/tests/.cache/deno/7acc8e7cf173abfbb82b4e379f1b367cddafc5d5.ts
2021-11-09 20:42:49 +09:00

18 lines
663 B
TypeScript

// Loaded from https://deno.land/x/graphql_deno@v15.0.0/lib/jsutils/defineToJSON.js
import nodejsCustomInspectSymbol from './nodejsCustomInspectSymbol.js';
/**
* The `defineToJSON()` function defines toJSON() and inspect() prototype
* methods, if no function provided they become aliases for toString().
*/
export default function defineToJSON(classObject, fn = classObject.prototype.toString) {
classObject.prototype.toJSON = fn;
classObject.prototype.inspect = fn;
/* istanbul ignore else (See: https://github.com/graphql/graphql-js/issues/2317) */
if (nodejsCustomInspectSymbol) {
classObject.prototype[nodejsCustomInspectSymbol] = fn;
}
}