-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
afe7af0
commit 3c72cbd
Showing
9 changed files
with
59 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "carbon-footprint", | ||
"version": "1.4.2", | ||
"description": "Calculate your carbon footprint. Food, transport, purchases, electricity and digital activities like streaming.", | ||
"version": "1.5.0", | ||
"description": "Calculate your carbon footprint. Food, transport, purchases, fashion, electricity and digital activities like streaming.", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"scripts": { | ||
|
@@ -29,7 +29,8 @@ | |
"purchases", | ||
"digital", | ||
"streaming", | ||
"electricity" | ||
"electricity", | ||
"fashion" | ||
], | ||
"author": "NMF.earth <[email protected]> (http://nmf.earth)", | ||
"license": "GPLv3", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { keys, map } from 'ramda'; | ||
import fashion from '../fashion'; | ||
import { FashionType } from '../fashion.enum'; | ||
|
||
test('All fashion keys should contain a valid number', () => { | ||
const purchaseKeys = keys(fashion); | ||
map((item: number) => expect(typeof purchaseKeys[item]).toBe('number')); | ||
}); | ||
|
||
test('Number of default exports equals number of enums', () => { | ||
const enumsCount = Object.keys(FashionType).length; | ||
const defaultExportsCount = Object.keys(fashion).length; | ||
|
||
expect(defaultExportsCount).toEqual(enumsCount); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export enum FashionType { | ||
shirt = 'shirt', | ||
tshirt = 'tshirt', | ||
jeans = 'jeans', | ||
sweater = 'sweater', | ||
coat = 'coat', | ||
dress = 'dress', | ||
shoes = 'shoes', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* Unit: kgCO2eq per product */ | ||
|
||
/* Clothing | ||
https://www.ademe.fr/sites/default/files/assets/documents/poids_carbone-biens-equipement-201809-rapport.pdf | ||
*/ | ||
const shirt = (13 + 12) / 2; | ||
const tshirt = (7 + 10 + 6) / 3; | ||
const jeans = 25; | ||
const sweater = (28 + 26 + 31 + 56 + 12) / 5; | ||
const coat = (89 + 39 + 25) / 3; | ||
const dress = (56 + 56 + 51) / 3; | ||
const shoes = (15 + 19 + 20) / 3; | ||
|
||
export default { | ||
shirt, | ||
tshirt, | ||
jeans, | ||
sweater, | ||
coat, | ||
dress, | ||
shoes, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import fashion from './fashion'; | ||
import { FashionType } from './fashion.enum'; | ||
|
||
export { fashion, FashionType }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters