From 53686af6e22f1a08c6c2a18a850991236821bdbf Mon Sep 17 00:00:00 2001 From: Sebastien Ahkrin Date: Fri, 13 Dec 2019 22:13:49 +0100 Subject: [PATCH] lib: replace Symbol.hasInstance by SymbolHasInstance --- lib/_stream_writable.js | 7 ++++--- lib/internal/console/constructor.js | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 0e0d87ae1d198d..8d26b71136d53c 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -30,6 +30,7 @@ const { ObjectDefineProperty, ObjectSetPrototypeOf, Symbol, + SymbolHasInstance, } = primordials; module.exports = Writable; @@ -203,9 +204,9 @@ ObjectDefineProperty(WritableState.prototype, 'buffer', { // Test _writableState for inheritance to account for Duplex streams, // whose prototype chain only points to Readable. var realHasInstance; -if (typeof Symbol === 'function' && Symbol.hasInstance) { - realHasInstance = Function.prototype[Symbol.hasInstance]; - ObjectDefineProperty(Writable, Symbol.hasInstance, { +if (typeof Symbol === 'function' && SymbolHasInstance) { + realHasInstance = Function.prototype[SymbolHasInstance]; + ObjectDefineProperty(Writable, SymbolHasInstance, { value: function(object) { if (realHasInstance.call(this, object)) return true; diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js index 85b88a72ea9290..1ad728d2e3ea5b 100644 --- a/lib/internal/console/constructor.js +++ b/lib/internal/console/constructor.js @@ -16,6 +16,7 @@ const { ObjectValues, ReflectOwnKeys, Symbol, + SymbolHasInstance, } = primordials; const { trace } = internalBinding('trace_events'); @@ -134,7 +135,7 @@ const consolePropAttributes = { }; // Fixup global.console instanceof global.console.Console -ObjectDefineProperty(Console, Symbol.hasInstance, { +ObjectDefineProperty(Console, SymbolHasInstance, { value(instance) { return instance[kIsConsole]; }