thegreenwebfoundation / co2.js

An npm module for accessing the green web API, and estimating the carbon emissions from using digital services
Other
385 stars 48 forks source link

Fixes issue #140 #142

Closed PrathumP closed 1 year ago

fershad commented 1 year ago

@PrathumP thanks for starting this. averageIntensity exports an object with two keys: data (object) and type (string). You can see that here: https://github.com/thegreenwebfoundation/co2.js/blob/8d87ca9ca56489df3272a48ce4b0ee62ff368008/src/data/average-intensities.min.js

Inside of the data object, we want to get the value for the "WORLD" and use that for the GLOBAL_GRID_INTENSITY constant.

https://github.com/thegreenwebfoundation/co2.js/blob/9014711cb6326b304e15a29819998b149000b166/src/constants/index.js#L18

Can you update the PR with this please.

PrathumP commented 1 year ago

I've corrected the error in the new commit.

fershad commented 1 year ago

Thanks @PrathumP. This looks good.

There is some work needed to update the tests, but I will take care of those later this week & then commit this PR.

Thank you for your contribution.