util: use hasOwnProperty() primordial

Avoid Object.prototype.hasOwnProperty. Use primordial instead.

PR-URL: https://github.com/nodejs/node/pull/41692
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Rich Trott
2022-01-25 07:14:18 -08:00
parent 5d9caa1c2f
commit acc92a77cb

View File

@@ -5,6 +5,7 @@ const {
FunctionPrototypeBind,
ObjectDefineProperty,
ObjectKeys,
ObjectPrototypeHasOwnProperty,
} = primordials;
let session;
@@ -43,7 +44,7 @@ function wrapConsole(consoleFromNode, consoleFromVM) {
// If global console has the same method as inspector console,
// then wrap these two methods into one. Native wrapper will preserve
// the original stack.
if (consoleFromNode.hasOwnProperty(key)) {
if (ObjectPrototypeHasOwnProperty(consoleFromNode, key)) {
consoleFromNode[key] = FunctionPrototypeBind(
consoleCall,
consoleFromNode,