Skip to content

Commit f51b5bd

Browse files
Sebastien-AhkrinMylesBorins
authored andcommitted
lib: replace Symbol.hasInstance by SymbolHasInstance
PR-URL: #30948 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 92475e9 commit f51b5bd

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/_stream_writable.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const {
3030
ObjectDefineProperty,
3131
ObjectSetPrototypeOf,
3232
Symbol,
33+
SymbolHasInstance,
3334
} = primordials;
3435

3536
module.exports = Writable;
@@ -203,9 +204,9 @@ ObjectDefineProperty(WritableState.prototype, 'buffer', {
203204
// Test _writableState for inheritance to account for Duplex streams,
204205
// whose prototype chain only points to Readable.
205206
var realHasInstance;
206-
if (typeof Symbol === 'function' && Symbol.hasInstance) {
207-
realHasInstance = Function.prototype[Symbol.hasInstance];
208-
ObjectDefineProperty(Writable, Symbol.hasInstance, {
207+
if (typeof Symbol === 'function' && SymbolHasInstance) {
208+
realHasInstance = Function.prototype[SymbolHasInstance];
209+
ObjectDefineProperty(Writable, SymbolHasInstance, {
209210
value: function(object) {
210211
if (realHasInstance.call(this, object))
211212
return true;

lib/internal/console/constructor.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const {
1616
ObjectValues,
1717
ReflectOwnKeys,
1818
Symbol,
19+
SymbolHasInstance,
1920
} = primordials;
2021

2122
const { trace } = internalBinding('trace_events');
@@ -133,7 +134,7 @@ const consolePropAttributes = {
133134
};
134135

135136
// Fixup global.console instanceof global.console.Console
136-
ObjectDefineProperty(Console, Symbol.hasInstance, {
137+
ObjectDefineProperty(Console, SymbolHasInstance, {
137138
value(instance) {
138139
return instance[kIsConsole];
139140
}

0 commit comments

Comments
 (0)