From 900953a65a7cb54eb8d11eba4a30e52da7dbb469 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Tue, 9 Feb 2021 15:31:46 +0000 Subject: fix(op_crates): Don't use `Deno.inspect` in op crates (#9332) Co-authored-by: Yoshiya Hinosawa --- op_crates/fetch/11_streams.js | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'op_crates/fetch/11_streams.js') diff --git a/op_crates/fetch/11_streams.js b/op_crates/fetch/11_streams.js index af9cc321f..5ddb1902a 100644 --- a/op_crates/fetch/11_streams.js +++ b/op_crates/fetch/11_streams.js @@ -7,8 +7,6 @@ "use strict"; ((window) => { - const customInspect = Symbol.for("Deno.customInspect"); - class AssertionError extends Error { constructor(msg) { super(msg); @@ -3224,10 +3222,8 @@ return iterator; } - [customInspect]() { - return `${this.constructor.name} ${ - Deno.inspect({ locked: this.locked }) - }`; + [Symbol.for("Deno.customInspect")](inspect) { + return `${this.constructor.name} ${inspect({ locked: this.locked })}`; } } @@ -3308,8 +3304,8 @@ readableStreamReaderGenericRelease(this); } - [customInspect]() { - return `${this.constructor.name} { closed: ${String(this.closed)} }`; + [Symbol.for("Deno.customInspect")](inspect) { + return `${this.constructor.name} ${inspect({ closed: this.closed })}`; } } @@ -3597,12 +3593,9 @@ return this[_writable]; } - [customInspect]() { + [Symbol.for("Deno.customInspect")](inspect) { return `${this.constructor.name} ${ - Deno.inspect( - { readable: this.readable, writable: this.writable }, - { depth: 1 }, - ) + inspect({ readable: this.readable, writable: this.writable }) }`; } } @@ -3736,10 +3729,8 @@ return acquireWritableStreamDefaultWriter(this); } - [customInspect]() { - return `${this.constructor.name} ${ - Deno.inspect({ locked: this.locked }) - }`; + [Symbol.for("Deno.customInspect")](inspect) { + return `${this.constructor.name} ${inspect({ locked: this.locked })}`; } } -- cgit v1.2.3