thegreenwebfoundation / thegreenwebfoundation/developer-docs
Mismatch between imports behaviour and docs
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 7
- Forks
- 15
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
It looks like importing CO2.js and using the hosting check function is working differently to the docs.
Our docs say:
const { hosting } = require("@tgwf/co2");
hosting.check("google.com", options).then((result) => {
console.log(result);
});
It looks like what worked in the end was
const { hosting } = require("@tgwf/co2");
hosting(google.com", options).then((result) => {
console.log(result);
});
To Reproduce
Steps to reproduce the behavior:
(@samuelIkoli to share more notes)
Expected behavior
A clear and concise description of what you expected to happen.
When I tried using CO2.JS as an npm package in my react (javascript) site, when doing the check to see if your domain hosting is green, rather than the 'hosting.check(domain)' which is on the official documentation (kept giving a 'hosting.check is not a function), what worked was hosting(domain).
Environment (please complete the following information):
Browser - react
Additional context (if applicable)
Add any other context about the problem here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked hosting tutorial at developers.thegreenwebfoundation.org/co2js/tutorials/check-hosting/ and compare its hosting.check(domain) example with the reported hosting(domain) usage. Verify the documented import and call against the actual CO2.js behavior, then update the documentation so the example works as shown and clearly reflects the supported API.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100