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

Update function comments #164

Closed drydenwilliams closed 1 year ago

drydenwilliams commented 1 year ago

Describe the bug The params in comments doesn't match the code arguments

To Reproduce Steps to reproduce the behavior:

  1. Go to #L162 and view param, it expects be a number
  2. Go to #L173 which throws an error if it's not a boolean

Expected behavior Ideally, it would accept a number for carbon intensity not a boolean what does this toggle, if it's "green" or not?

fershad commented 1 year ago

I know there's a reason the code (#L173) is like that, but I'll need to dig into the memory bank as to why.

Regardless, yes the JS Doc comments do need to be updated to reflect what types are accepted.

fershad commented 1 year ago

@drydenwilliams yeah the comments were showing the incorrect type. number should have been boolean. I've fixed that in #167.

The change will go into the next version release of CO2.js in early September.