Skip to content

Commit e01433d

Browse files
Sebastien-AhkrinBethGriggs
authored andcommitted
lib: replace Symbol.hasInstance by SymbolHasInstance
PR-URL: #30948 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 497a1c8 commit e01433d

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)