mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
lib: replace Symbol.hasInstance by SymbolHasInstance
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
1 parent
497a1c8405
commit
e01433db8b
2 files changed
+6
-4
No files matched your search
@@ -30,6 +30,7 @@ const {
|
||||
ObjectDefineProperty,
|
||||
ObjectSetPrototypeOf,
|
||||
Symbol,
|
||||
SymbolHasInstance,
|
||||
} = primordials;
|
||||
|
||||
module.exports = Writable;
|
||||
@@ -196,9 +197,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;
|
||||
|
||||
@@ -14,6 +14,7 @@ const {
|
||||
ObjectValues,
|
||||
ReflectOwnKeys,
|
||||
Symbol,
|
||||
SymbolHasInstance,
|
||||
} = primordials;
|
||||
|
||||
const { trace } = internalBinding('trace_events');
|
||||
@@ -128,7 +129,7 @@ const consolePropAttributes = {
|
||||
};
|
||||
|
||||
// Fixup global.console instanceof global.console.Console
|
||||
ObjectDefineProperty(Console, Symbol.hasInstance, {
|
||||
ObjectDefineProperty(Console, SymbolHasInstance, {
|
||||
value(instance) {
|
||||
return instance[kIsConsole];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user