Skip to content

Commit 581e837

Browse files
Sebastien-Ahkrintargos
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 5cfcf6f commit 581e837

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;
@@ -196,9 +197,9 @@ ObjectDefineProperty(WritableState.prototype, 'buffer', {
196197
// Test _writableState for inheritance to account for Duplex streams,
197198
// whose prototype chain only points to Readable.
198199
var realHasInstance;
199-
if (typeof Symbol === 'function' && Symbol.hasInstance) {
200-
realHasInstance = Function.prototype[Symbol.hasInstance];
201-
ObjectDefineProperty(Writable, Symbol.hasInstance, {
200+
if (typeof Symbol === 'function' && SymbolHasInstance) {
201+
realHasInstance = Function.prototype[SymbolHasInstance];
202+
ObjectDefineProperty(Writable, SymbolHasInstance, {
202203
value: function(object) {
203204
if (realHasInstance.call(this, object))
204205
return true;

lib/internal/console/constructor.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const {
1414
ObjectValues,
1515
ReflectOwnKeys,
1616
Symbol,
17+
SymbolHasInstance,
1718
} = primordials;
1819

1920
const { trace } = internalBinding('trace_events');
@@ -128,7 +129,7 @@ const consolePropAttributes = {
128129
};
129130

130131
// Fixup global.console instanceof global.console.Console
131-
ObjectDefineProperty(Console, Symbol.hasInstance, {
132+
ObjectDefineProperty(Console, SymbolHasInstance, {
132133
value(instance) {
133134
return instance[kIsConsole];
134135
}

0 commit comments

Comments
 (0)