Skip to content

Commit 2434b99

Browse files
committed
Refactor: Use centralized hasOwnProperty utility functions
1 parent ab18f33 commit 2434b99

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

compiler/packages/babel-plugin-react-compiler/src/Utils/ComponentDeclaration.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
import * as t from '@babel/types';
9+
import {hasOwnProperty} from './utils';
910

1011
export type ComponentDeclaration = t.FunctionDeclaration & {
1112
__componentDeclaration: boolean;
@@ -14,7 +15,7 @@ export type ComponentDeclaration = t.FunctionDeclaration & {
1415
export function isComponentDeclaration(
1516
node: t.FunctionDeclaration,
1617
): node is ComponentDeclaration {
17-
return Object.prototype.hasOwnProperty.call(node, '__componentDeclaration');
18+
return hasOwnProperty(node, '__componentDeclaration');
1819
}
1920

2021
export function parseComponentDeclaration(

compiler/packages/babel-plugin-react-compiler/src/Utils/HookDeclaration.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
import * as t from '@babel/types';
9+
import {hasOwnProperty} from './utils';
910

1011
export type HookDeclaration = t.FunctionDeclaration & {
1112
__hookDeclaration: boolean;
@@ -14,7 +15,7 @@ export type HookDeclaration = t.FunctionDeclaration & {
1415
export function isHookDeclaration(
1516
node: t.FunctionDeclaration,
1617
): node is HookDeclaration {
17-
return Object.prototype.hasOwnProperty.call(node, '__hookDeclaration');
18+
return hasOwnProperty(node, '__hookDeclaration');
1819
}
1920

2021
export function parseHookDeclaration(

packages/react-devtools-shared/src/devtools/views/utils.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@ import escapeStringRegExp from 'escape-string-regexp';
1111
import {meta} from '../../hydration';
1212
import {formatDataForPreview} from '../../utils';
1313
import isArray from 'react-devtools-shared/src/isArray';
14+
import hasOwnProperty from 'shared/hasOwnProperty';
1415

1516
import type {HooksTree} from 'react-debug-tools/src/ReactDebugHooks';
1617

17-
// $FlowFixMe[method-unbinding]
18-
const hasOwnProperty = Object.prototype.hasOwnProperty;
19-
2018
export function alphaSortEntries(
2119
entryA: [string, mixed],
2220
entryB: [string, mixed],

0 commit comments

Comments
 (0)