一部functionの分岐
This commit is contained in:
15
lib/eachTrainInfoCoreLib/getStationData.js
Normal file
15
lib/eachTrainInfoCoreLib/getStationData.js
Normal 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];
|
||||
};
|
Reference in New Issue
Block a user