Skip to content

Commit

Permalink
clean code on empty items
Browse files Browse the repository at this point in the history
  • Loading branch information
kermage committed Apr 25, 2024
1 parent be10174 commit d62303d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/CodePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ const item = (value: FieldItemType) => {
const wrap = (value: Signal<FieldItemType>[]) => {
const items = Object.values(value).map((val) => `${item(val.value)}`);

if (!items.length) {
return 'array();';
}

return `array(
${items.join(',\n\t')},
);`;
Expand Down

0 comments on commit d62303d

Please sign in to comment.