swc/bundler/tests/.cache/deno/7acc8e7cf173abfbb82b4e379f1b367cddafc5d5.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +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;
}
}