From 49eb887cc6325e14211ec4a241ffc4ac98f0f7a9 Mon Sep 17 00:00:00 2001 From: Kenta Moriuchi Date: Tue, 2 May 2023 19:15:45 +0900 Subject: refactor(core): Use `ObjectHasOwn` instead of `ObjectPrototypeHasOwnProperty` (#18952) ES2022 `Object.hasOwn` can be used in snapshot, so I migrate to use it. --- ext/node/polyfills/01_require.js | 4 ++-- ext/node/polyfills/internal/child_process.ts | 4 ++-- ext/node/polyfills/internal/primordials.mjs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'ext/node') diff --git a/ext/node/polyfills/01_require.js b/ext/node/polyfills/01_require.js index ce7312ee8..c73701ba8 100644 --- a/ext/node/polyfills/01_require.js +++ b/ext/node/polyfills/01_require.js @@ -16,7 +16,7 @@ const { ArrayPrototypeSplice, ObjectGetOwnPropertyDescriptor, ObjectGetPrototypeOf, - ObjectPrototypeHasOwnProperty, + ObjectHasOwn, ObjectSetPrototypeOf, ObjectKeys, ObjectEntries, @@ -433,7 +433,7 @@ const CircularRequirePrototypeWarningProxy = new Proxy({}, { getOwnPropertyDescriptor(target, prop) { if ( - ObjectPrototypeHasOwnProperty(target, prop) || prop === "__esModule" + ObjectHasOwn(target, prop) || prop === "__esModule" ) { return ObjectGetOwnPropertyDescriptor(target, prop); } diff --git a/ext/node/polyfills/internal/child_process.ts b/ext/node/polyfills/internal/child_process.ts index 7c72cb0ca..edc4caa5e 100644 --- a/ext/node/polyfills/internal/child_process.ts +++ b/ext/node/polyfills/internal/child_process.ts @@ -34,7 +34,7 @@ import { ArrayPrototypeSlice, ArrayPrototypeSort, ArrayPrototypeUnshift, - ObjectPrototypeHasOwnProperty, + ObjectHasOwn, StringPrototypeToUpperCase, } from "ext:deno_node/internal/primordials.mjs"; import { kEmptyObject } from "ext:deno_node/internal/util.mjs"; @@ -429,7 +429,7 @@ function copyProcessEnvToEnv( if ( Deno.env.get(name) && (!optionEnv || - !ObjectPrototypeHasOwnProperty(optionEnv, name)) + !ObjectHasOwn(optionEnv, name)) ) { env[name] = Deno.env.get(name); } diff --git a/ext/node/polyfills/internal/primordials.mjs b/ext/node/polyfills/internal/primordials.mjs index 1639efdb5..8127eebac 100644 --- a/ext/node/polyfills/internal/primordials.mjs +++ b/ext/node/polyfills/internal/primordials.mjs @@ -12,7 +12,7 @@ export const ArrayPrototypeSort = (that, ...args) => that.sort(...args); export const ArrayPrototypeUnshift = (that, ...args) => that.unshift(...args); export const ObjectAssign = Object.assign; export const ObjectCreate = Object.create; -export const ObjectPrototypeHasOwnProperty = Object.hasOwn; +export const ObjectHasOwn = Object.hasOwn; export const RegExpPrototypeTest = (that, ...args) => that.test(...args); export const RegExpPrototypeExec = RegExp.prototype.exec; export const StringFromCharCode = String.fromCharCode; -- cgit v1.2.3