Skip to content

EvanHahn/trip-to-carbon-xyz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trip-to-carbon

A wrapper for the Trip to Carbon API.

Install it from npm:

npm install trip-to-carbon-xyz

Usage:

import { carbonFootprint } from "trip-to-carbon-xyz";

const taxiFootprint = await carbonFootprint({
  token: "YourAppToken", // optional
  country: "USA",
  distance: {
    amount: 10,
    unit: "miles",
    mode: "taxi",
  },
});
console.log(
  `Your 10-mile taxi trip had a carbon footprint of ${taxiFootprint} kilograms.`,
);

const fuelFootprint = await carbonFootprint({
  token: "YourAppToken", // optional
  country: "GBR",
  fuel: {
    amount: 456,
    unit: "gallons",
    type: "jetFuel",
  },
});

About

a light wrapper around triptocarbon.xyz

Resources

License

Stars

Watchers

Forks

Packages

No packages published