Open fershad opened 4 days ago
One way this might work is if the zone
could be either a string
or an object
.
In the case it is an object
, we could then check for the lat
and lon
keys inside.
In the case it is a string
, the current functionality would prevail.
The Electricity Maps API allows us to pass either a
zone
orlat
andlon
values when querying for power breakdown or grid intensity. Currently thegridAwarePower
andgridAwareCO2e
functions only use thezone
(Alpha 2 ISO country code).Desired state
It should be possible to pass in either the
zone
orlat
andlon
values into either of the functions.The likeliest easy solution would be to accept these values in an
options
object passed into each function. An alternate approach would be to have a config step where the user defines which location type (zone
/lat
+lon
) they want to use.