MCPcopy Create free account
hub / github.com/Necriso/ScriptableWidgets / loadStation

Function loadStation

tankstellenpreise.js:63–78  ·  view source on GitHub ↗
(apiKey, radius, fixedLocation, myLocation)

Source from the content-addressed store, hash-verified

61Script.complete()
62
63async 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
80function formatValue(value) {
81 if (!value) {

Callers 1

Calls 1

apiURLFunction · 0.70

Tested by

no test coverage detected