Use Object.hasOwn instead of Reflect.has in build script (#13495)

Use `Object.hasOwn` instead of `Reflect.has`
This commit is contained in:
Sosuke Suzuki authored and GitHub committed 2022-09-18 18:32:17 +09:00
1 parent 3211122de7
commit 8cfdcaa6b2
1 file changed
+7 -7
@@ -37,8 +37,8 @@ function processReplacements(replacements) {
}
if (
Reflect.has(replacement, "external") ||
Reflect.has(replacement, "path")
Object.hasOwn(replacement, "external") ||
Object.hasOwn(replacement, "path")
) {
if (module === "*") {
throw new Error("Can not replace all modules with the same path.");
@@ -48,7 +48,7 @@ function processReplacements(replacements) {
onResolveReplacements.set(
module,
Reflect.has(replacement, "external")
Object.hasOwn(replacement, "external")
? { external: true, path: replacement.external }
: { path: replacement.path }
);
@@ -56,7 +56,7 @@ function processReplacements(replacements) {
continue;
}
if (Reflect.has(replacement, "text")) {
if (Object.hasOwn(replacement, "text")) {
if (module === "*") {
throw new Error("Can not replace all modules with the same content.");
}
@@ -81,7 +81,7 @@ function processReplacements(replacements) {
const processFunctions = onLoadProcessors.get(module);
if (Reflect.has(replacement, "process")) {
if (Object.hasOwn(replacement, "process")) {
const { process } = replacement;
if (typeof process !== "function") {
throw new TypeError("'process' option should be a function.");
@@ -92,8 +92,8 @@ function processReplacements(replacements) {
}
if (
Reflect.has(replacement, "find") &&
Reflect.has(replacement, "replacement")
Object.hasOwn(replacement, "find") &&
Object.hasOwn(replacement, "replacement")
) {
processFunctions.push((text) =>
text.replaceAll(replacement.find, replacement.replacement)