一部functionの分岐

This commit is contained in:
harukin-OneMix4
2024-02-14 00:48:34 +09:00
parent 91c8bec6b0
commit 039dff5d8f
7 changed files with 265 additions and 228 deletions

View File

@@ -0,0 +1,15 @@
// 駅名から駅情報を取得する
//stationName: 駅名
//stationList: 駅情報リスト
export const getStationData = (stationName, stationList) => {
const Stations = stationList.map((a) =>
a.filter((d) => d.StationName == stationName)
);
const Station =
Stations &&
Stations.reduce((newArray, e) => {
return newArray.concat(e);
}, []);
if (!Station[0]) return [];
return Station.map((d) => d.StationNumber)[0];
};