Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
lib: replace Symbol.hasInstance by SymbolHasInstance
  • Loading branch information
Sebastien-Ahkrin committed Dec 13, 2019
commit 53686af6e22f1a08c6c2a18a850991236821bdbf
7 changes: 4 additions & 3 deletions lib/_stream_writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const {
ObjectDefineProperty,
ObjectSetPrototypeOf,
Symbol,
SymbolHasInstance,
} = primordials;

module.exports = Writable;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion lib/internal/console/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const {
ObjectValues,
ReflectOwnKeys,
Symbol,
SymbolHasInstance,
} = primordials;

const { trace } = internalBinding('trace_events');
Expand Down Expand Up @@ -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];
}
Expand Down