| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,7 +13,6 @@ const { | |||
| 13 | 13 | ObjectGetOwnPropertyNames, | |
| 14 | 14 | ObjectGetPrototypeOf, | |
| 15 | 15 | ObjectKeys, | |
| 16 | - ObjectPrototypeHasOwnProperty, | ||
| 17 | 16 | ObjectPrototypeToString, | |
| 18 | 17 | RangeError, | |
| 19 | 18 | ReferenceError, | |
@@ -134,8 +133,7 @@ function serializeError(error) { | |||
| 134 | 133 | // Continue regardless of error. | |
| 135 | 134 | } | |
| 136 | 135 | try { | |
| 137 | - if (error != null && | ||
| 138 | - ObjectPrototypeHasOwnProperty(error, customInspectSymbol)) { | ||
| 136 | + if (error != null && customInspectSymbol in error) { | ||
| 139 | 137 | return Buffer.from(StringFromCharCode(kCustomInspectedObject) + inspect(error), 'utf8'); | |
| 140 | 138 | } | |
| 141 | 139 | } catch { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -125,3 +125,11 @@ const data = { | |||
| 125 | 125 | } | |
| 126 | 126 | }; | |
| 127 | 127 | assert.strictEqual(inspect(cycle(data)), 'barbaz'); | |
| 128 | + | ||
| 129 | + const inheritedCustomInspect = new class { | ||
| 130 | + foo = 'bar'; | ||
| 131 | + [inspect.custom]() { | ||
| 132 | + return 'barbaz'; | ||
| 133 | + } | ||
| 134 | + }(); | ||
| 135 | + assert.strictEqual(inspect(cycle(inheritedCustomInspect)), 'barbaz'); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments