Skip to content

Commit

Permalink
default value 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
lee committed Jan 7, 2025
1 parent fa03bfe commit 2ad9b45
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/playground/blocks/block_expansion_disasterAlert.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ const getDisasterAlert = (params, defaultValue) => {
}
switch (params.command) {
case 'count':
return resolve(items?.length || 0);
return resolve(items?.length || defaultValue || 0);
case 'get':
const result = items?.[params?.index - 1]?.[params.option];
if (!result) {
return resolve(defaultValue);
}
if (params?.option === 'REG_YMD') {
return resolve(new Date(result).toLocaleString());
}
Expand All @@ -62,7 +65,6 @@ const getDisasterAlert = (params, defaultValue) => {
return resolve(items?.length > 0);
default:
return resolve(defaultValue);
break;
}
}
return resolve(defaultValue);
Expand Down

0 comments on commit 2ad9b45

Please sign in to comment.