Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: replace Symbol.hasInstance by SymbolHasInstance #30948

Closed
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
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