(apiKey, radius, fixedLocation, myLocation)
| 61 | Script.complete() |
| 62 | |
| 63 | async function loadStation(apiKey, radius, fixedLocation, myLocation) { |
| 64 | let location |
| 65 | |
| 66 | if (fixedLocation) { |
| 67 | location = myLocation |
| 68 | } else { |
| 69 | location = await Location.current() |
| 70 | } |
| 71 | |
| 72 | const data = await new Request(apiURL(location, radius, apiKey)).loadJSON() |
| 73 | |
| 74 | if (data.stations.length === 0) { |
| 75 | return { error: 1 } |
| 76 | } |
| 77 | return data |
| 78 | } |
| 79 | |
| 80 | function formatValue(value) { |
| 81 | if (!value) { |
no test coverage detected