0.10.1 • Published 3 years ago

@howmuchgreen/howmuchcarbon v0.10.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@howmuchgreen/howmuchcarbon

npm

A library to access how much CO2Eq (equivalent in carbon dioxyde) a thing costs.

A HTTP API is also available: https://howmuch.green/api/macbook14

Installation

npm i @howmuchgreen/howmuchcarbon

Usage

import { howMuch } from "@howmuchgreen/howmuchcarbon";

const macbookPro14 = howMuch("macbook pro 14").bestResult;
console.log(macbookPro14.name); // 'MacBook Pro 14' 2021'
console.log(macbookPro14.co2Eq.averageInGrams); // 271000
console.log(macbookPro14.co2Eq.format()); // '271 kg'
console.log(macbookPro14.sources); // ['https://www.apple.com/environment/…']

More examples can be found in the usage-test directory.

Contributing

  1. Fork the repository
  2. Add new products in the things.json file
  3. Be sure to include a valid source, and more than one if needed
  4. Open a pull request

Dev setup

# Install dependencies
npm install

# Run tests
npm run test

# Run tests in watch mode
npm run test -- --watch

# Build in watch mode (runs tsc -b)
npm run build -- --watch

# Bundle this as a library (esm & cjs bundles) to use this as a library
npm run rollup

# Bundle this as a library in watch mode
npm run rollup -- --watch
# -- OR --
npm run dev

Publish the library

npx np --any-branch --no-2fa
0.10.0

3 years ago

0.10.1

3 years ago

0.9.0

3 years ago

0.8.1

3 years ago

0.8.0

3 years ago

0.7.0

3 years ago

0.6.0

3 years ago

0.5.1

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.3.2

3 years ago

0.3.0

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago