Skip to content

Commit

Permalink
committing SonarCloud Fix refactoring code from P1
Browse files Browse the repository at this point in the history
  • Loading branch information
eunseokk committed Sep 24, 2024
1 parent 56862d5 commit 29c75ea
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions public/src/admin/extend/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,16 @@ define('admin/extend/widgets', [
const data = $(this).find('form').serializeArray();

for (const d in data) {
if (data.hasOwnProperty(d)) {
if (data[d].name) {
if (widgetData[data[d].name]) {
if (!Array.isArray(widgetData[data[d].name])) {
widgetData[data[d].name] = [
widgetData[data[d].name],
];
}
widgetData[data[d].name].push(data[d].value);
} else {
widgetData[data[d].name] = data[d].value;
if (data.hasOwnProperty(d) && data[d].name) {
const name = data[d].name;
const value = data[d].value;
if (widgetData[name]) {
if (!Array.isArray(widgetData[name])) {
widgetData[name] = [widgetData[name]];
}
widgetData[name].push(value);
} else {
widgetData[name] = value;
}
}
}
Expand Down

0 comments on commit 29c75ea

Please sign in to comment.