.filterによるクラッシュを修正

This commit is contained in:
Last2014 2025-07-01 18:54:02 +09:00
parent 6c69ce80ef
commit 73091bb92f
1 changed files with 8 additions and 4 deletions

View File

@ -179,7 +179,7 @@ async function event(earthquakeInfo: any): Promise<void> {
const areaNames: Array<string> = Array.from( const areaNames: Array<string> = Array.from(
new Set( new Set(
earthquakeInfo.areas.map((i: any) => { earthquakeInfo.areas.map((i: any) => {
earthquakeInfo.areas[i].name.filter(Boolean); earthquakeInfo.areas[i].name;
}), }),
), ),
); );
@ -273,7 +273,11 @@ async function event(earthquakeInfo: any): Promise<void> {
if (earthquakeInfo.points !== null) { if (earthquakeInfo.points !== null) {
const areaNames: Array<string> = Array.from( const areaNames: Array<string> = Array.from(
new Set(earthquakeInfo.points.map((i: any) => i.addr).filter(Boolean)), new Set(
earthquakeInfo.points.map((i: any) => {
return earthquakeInfo.points[i.addr];
}).filter(Boolean)
),
); );
areas = `対象地域:${areaNames.join("・")}`; areas = `対象地域:${areaNames.join("・")}`;
@ -305,8 +309,8 @@ async function event(earthquakeInfo: any): Promise<void> {
const areaNames: Array<string> = Array.from( const areaNames: Array<string> = Array.from(
new Set( new Set(
earthquakeInfo.areas.map((i: any) => { earthquakeInfo.areas.map((i: any) => {
areaMaps[i.id].filter(Boolean); return areaMaps[i.id];
}), }).filter(Boolean)
), ),
); );