mirror of
https://github.com/warengroup/eximiabots-radiox.git
synced 2024-12-23 04:33:18 +00:00
Fix direct search in Stations class
This commit is contained in:
parent
c9229f3cda
commit
224a1f849d
@ -22,7 +22,7 @@ export default class Stations extends Array {
|
|||||||
.then(this.checkFetchStatus)
|
.then(this.checkFetchStatus)
|
||||||
.then((response: Response) => response.json());
|
.then((response: Response) => response.json());
|
||||||
|
|
||||||
for (const station of stations){
|
for(const station of stations){
|
||||||
this.push(station);
|
this.push(station);
|
||||||
if(options.show) logger('Stations', station.name);
|
if(options.show) logger('Stations', station.name);
|
||||||
}
|
}
|
||||||
@ -50,15 +50,8 @@ export default class Stations extends Array {
|
|||||||
if (this === null || !key || !type) return null;
|
if (this === null || !key || !type) return null;
|
||||||
|
|
||||||
if(type == "direct"){
|
if(type == "direct"){
|
||||||
let foundStation;
|
return this.find(station => station.name === key);
|
||||||
for(const station of this){
|
|
||||||
if(station.name != key) return null;
|
|
||||||
foundStation = station;
|
|
||||||
}
|
|
||||||
|
|
||||||
return foundStation;
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
let foundStations : { station: string, name: string, probability: number }[] = [];
|
let foundStations : { station: string, name: string, probability: number }[] = [];
|
||||||
if (key == "radio") return null;
|
if (key == "radio") return null;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user