Skip to content

Commit 6d8e5ce

Browse files
fix: use object hasOwn.
1 parent 7e86c46 commit 6d8e5ce

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

src/app.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@ const layoutTheme = createLayoutThemeController({
7575
const { applyAppGridLayout, applyTheme, getInitialAppGridLayout, getInitialTheme } =
7676
layoutTheme
7777

78-
const panelMap = {
79-
component: componentPanel,
80-
styles: stylesPanel,
81-
preview: previewPanel,
82-
}
83-
8478
const compactViewportMediaQuery = window.matchMedia('(max-width: 900px)')
8579

8680
const getCurrentLayout = () => {
@@ -155,7 +149,7 @@ const applyEditorToolsVisibility = () => {
155149

156150
for (const button of editorToolsButtons) {
157151
const panelName = button.dataset.editorToolsToggle
158-
if (!panelName || !(panelName in panelToolsState)) {
152+
if (!panelName || !Object.hasOwn(panelToolsState, panelName)) {
159153
continue
160154
}
161155

@@ -181,7 +175,7 @@ const syncPanelCollapseButtons = () => {
181175

182176
for (const button of panelCollapseButtons) {
183177
const panelName = button.dataset.panelCollapse
184-
if (!panelName || !(panelName in panelMap)) {
178+
if (!panelName || !Object.hasOwn(panelCollapseState, panelName)) {
185179
continue
186180
}
187181

@@ -273,7 +267,7 @@ const applyPanelCollapseState = () => {
273267
}
274268

275269
const togglePanelCollapse = panelName => {
276-
if (!(panelName in panelCollapseState)) {
270+
if (!Object.hasOwn(panelCollapseState, panelName)) {
277271
return
278272
}
279273

@@ -677,7 +671,7 @@ for (const button of appThemeButtons) {
677671
for (const button of editorToolsButtons) {
678672
button.addEventListener('click', () => {
679673
const panelName = button.dataset.editorToolsToggle
680-
if (!panelName || !(panelName in panelToolsState)) {
674+
if (!panelName || !Object.hasOwn(panelToolsState, panelName)) {
681675
return
682676
}
683677

0 commit comments

Comments
 (0)