@tgwf/co2 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -2
- package/dist/cjs/co2.js +9 -0
- package/dist/cjs/co2.js.map +2 -2
- package/dist/cjs/data/average-intensities.min.js +1 -1
- package/dist/cjs/data/average-intensities.min.js.map +2 -2
- package/dist/cjs/helpers/index.js +1 -1
- package/dist/cjs/hosting.js +1 -3
- package/dist/cjs/hosting.js.map +2 -2
- package/dist/esm/co2.js +9 -0
- package/dist/esm/data/average-intensities.min.js +1 -1
- package/dist/esm/helpers/index.js +1 -1
- package/dist/esm/hosting.js +1 -3
- package/jsr.json +8 -0
- package/mod.ts +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -16,13 +16,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
16
16
|
|
|
17
17
|
- Add ability to create adaptors which provide access to external data sources #134
|
|
18
18
|
- Add access to the Electricity Maps API free tier #134
|
|
19
|
-
- Add the Sustainable Web Design Rating system #205
|
|
20
|
-
- Add the updated Sustainable Web Design Model version 4 #119
|
|
21
19
|
- Allow access to individual models and their internal functions #195
|
|
22
20
|
<!-- - _(Add a summary of your feature, and if relevant the issue, in your PR for merging into `main`)_ -->
|
|
23
21
|
|
|
24
22
|
## Released
|
|
25
23
|
|
|
24
|
+
### [0.16.0] - 2024-07-01
|
|
25
|
+
|
|
26
|
+
#### _Added_
|
|
27
|
+
|
|
28
|
+
- Add the Sustainable Web Design Rating system #205
|
|
29
|
+
- Add the updated Sustainable Web Design Model version 4 #119
|
|
30
|
+
|
|
31
|
+
#### Changed
|
|
32
|
+
|
|
33
|
+
- Automated monthly update of annual average grid intensity data.
|
|
34
|
+
|
|
26
35
|
### [0.15.0] - 2024-05-03
|
|
27
36
|
|
|
28
37
|
#### Changed
|
package/dist/cjs/co2.js
CHANGED
|
@@ -114,6 +114,15 @@ See https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more ab
|
|
|
114
114
|
See https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`);
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
|
+
SustainableWebDesignV3() {
|
|
118
|
+
return new import_sustainable_web_design_v3.default();
|
|
119
|
+
}
|
|
120
|
+
SustainableWebDesignV4() {
|
|
121
|
+
return new import_sustainable_web_design_v4.default();
|
|
122
|
+
}
|
|
123
|
+
OneByte() {
|
|
124
|
+
return new import_byte.default();
|
|
125
|
+
}
|
|
117
126
|
}
|
|
118
127
|
var co2_default = CO2;
|
|
119
128
|
//# sourceMappingURL=co2.js.map
|
package/dist/cjs/co2.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/co2.js"],
|
|
4
|
-
"sourcesContent": ["\"use strict\";\n\n/**\n * @typedef {Object} CO2EstimateTraceResultPerByte\n * @property {number|CO2EstimateComponentsPerByte} co2 - The CO2 estimate in grams or its separate components\n * @property {boolean} green - Whether the domain is green or not\n * @property {TraceResultVariablesPerByte} variables - The variables used to calculate the CO2 estimate\n */\n\n/**\n * @typedef {Object} CO2EstimateTraceResultPerVisit\n * @property {number|CO2EstimateComponentsPerVisit} co2 - The CO2 estimate in grams or its separate components\n * @property {boolean} green - Whether the domain is green or not\n * @property {TraceResultVariablesPerVisit} variables - The variables used to calculate the CO2 estimate\n */\n\n/**\n * @typedef {Object} TraceResultVariablesPerByte\n * @property {GridIntensityVariables} gridIntensity - The grid intensity related variables\n */\n/**\n * @typedef {Object} TraceResultVariablesPerVisit\n * @property {GridIntensityVariables} gridIntensity - The grid intensity related variables\n * @property {number} dataReloadRatio - What percentage of a page is reloaded on each subsequent page view\n * @property {number} firstVisitPercentage - What percentage of visits are loading this page for subsequent times\n * @property {number} returnVisitPercentage - What percentage of visits are loading this page for the second or more time\n */\n\n/**\n * @typedef {Object} GridIntensityVariables\n * @property {string} description - The description of the variables\n * @property {number} network - The network grid intensity set by the user or the default\n * @property {number} dataCenter - The data center grid intensity set by the user or the default\n * @property {number} device - The device grid intensity set by the user or the default\n * @property {number} production - The production grid intensity set by the user or the default\n */\n\n/**\n * @typedef {Object} CO2EstimateComponentsPerByte\n * @property {number} networkCO2 - The CO2 estimate for networking in grams\n * @property {number} dataCenterCO2 - The CO2 estimate for data centers in grams\n * @property {number} consumerDeviceCO2 - The CO2 estimate for consumer devices in grams\n * @property {number} productionCO2 - The CO2 estimate for device production in grams\n * @property {string} rating - The rating of the CO2 estimate based on the Sustainable Web Design Model\n * @property {number} total - The total CO2 estimate in grams\n */\n\n/**\n * @typedef {Object} CO2EstimateComponentsPerVisit\n * @property {number} 'networkCO2 - first' - The CO2 estimate for networking in grams on first visit\n * @property {number} 'networkCO2 - subsequent' - The CO2 estimate for networking in grams on subsequent visits\n * @property {number} 'dataCenterCO2 - first' - The CO2 estimate for data centers in grams on first visit\n * @property {number} 'dataCenterCO2 - subsequent' - The CO2 estimate for data centers in grams on subsequent visits\n * @property {number} 'consumerDeviceCO2 - first' - The CO2 estimate for consumer devices in grams on first visit\n * @property {number} 'consumerDeviceCO2 - subsequent' - The CO2 estimate for consumer devices in grams on subsequent visits\n * @property {number} 'productionCO2 - first' - The CO2 estimate for device production in grams on first visit\n * @property {number} 'productionCO2 - subsequent' - The CO2 estimate for device production in grams on subsequent visits\n * @property {string} rating - The rating of the CO2 estimate based on the Sustainable Web Design Model\n * @property {number} total - The total CO2 estimate in grams\n */\n\nimport OneByte from \"./1byte.js\";\nimport SustainableWebDesignV3 from \"./sustainable-web-design-v3.js\";\nimport SustainableWebDesignV4 from \"./sustainable-web-design-v4.js\";\n\nimport {\n GLOBAL_GRID_INTENSITY,\n RENEWABLES_GRID_INTENSITY,\n} from \"./constants/index.js\";\nimport { parseOptions } from \"./helpers/index.js\";\n\nclass CO2 {\n constructor(options) {\n this.model = new SustainableWebDesignV3();\n // Using optional chaining allows an empty object to be passed\n // in without breaking the code.\n if (options?.model === \"1byte\") {\n this.model = new OneByte();\n } else if (options?.model === \"swd\") {\n this.model = new SustainableWebDesignV3();\n if (options?.version === 4) {\n this.model = new SustainableWebDesignV4();\n }\n } else if (options?.model) {\n throw new Error(\n `\"${options.model}\" is not a valid model. Please use \"1byte\" for the OneByte model, and \"swd\" for the Sustainable Web Design model.\\nSee https://developers.thegreenwebfoundation.org/co2js/models/ to learn more about the models available in CO2.js.`\n );\n }\n\n if (options?.rating && typeof options.rating !== \"boolean\") {\n throw new Error(\n `The rating option must be a boolean. Please use true or false.\\nSee https://developers.thegreenwebfoundation.org/co2js/options/ to learn more about the options available in CO2.js.`\n );\n }\n\n // This flag checks to see if the model itself has a rating system.\n const allowRatings = !!this.model.allowRatings;\n\n /** @private */\n this._segment = options?.results === \"segment\";\n // This flag is set by the user to enable the rating system.\n this._rating = options?.rating === true;\n\n // The rating system is only supported in the Sustainable Web Design Model.\n if (!allowRatings && this._rating) {\n throw new Error(\n `The rating system is not supported in the model you are using. Try using the Sustainable Web Design model instead.\\nSee https://developers.thegreenwebfoundation.org/co2js/models/ to learn more about the models available in CO2.js.`\n );\n }\n }\n\n /**\n * Accept a figure in bytes for data transfer, and a boolean for whether\n * the domain shows as 'green', and return a CO2 figure for energy used to shift the corresponding\n * the data transfer.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @return {number|CO2EstimateComponentsPerByte} the amount of CO2 in grammes or its separate components\n */\n perByte(bytes, green = false) {\n return this.model.perByte(bytes, green, this._segment, this._rating);\n }\n\n /**\n * Accept a figure in bytes for data transfer, and a boolean for whether\n * the domain shows as 'green', and return a CO2 figure for energy used to shift the corresponding\n * the data transfer.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @return {number|CO2EstimateComponentsPerVisit} the amount of CO2 in grammes or its separate components\n */\n perVisit(bytes, green = false) {\n if (this.model?.perVisit) {\n return this.model.perVisit(bytes, green, this._segment, this._rating);\n } else {\n throw new Error(\n `The perVisit() method is not supported in the model you are using. Try using perByte() instead.\\nSee https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`\n );\n }\n }\n\n /**\n * Accept a figure in bytes for data transfer, a boolean for whether\n * the domain shows as 'green', and an options object.\n * Returns an object containing CO2 figure, green boolean, and object of the variables used in calculating the CO2 figure.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @param {Object} options\n * @return {CO2EstimateTraceResultPerByte} the amount of CO2 in grammes\n */\n perByteTrace(bytes, green = false, options = {}) {\n const adjustments = parseOptions(options, this.model.version, green);\n\n // Filter out the trace items that aren't relevant to this function.\n const { gridIntensity, ...traceVariables } = adjustments;\n const {\n dataReloadRatio,\n firstVisitPercentage,\n returnVisitPercentage,\n ...otherVariables\n } = traceVariables;\n return {\n co2: this.model.perByte(\n bytes,\n green,\n this._segment,\n this._rating,\n adjustments\n ),\n green,\n variables: {\n description:\n \"Below are the variables used to calculate this CO2 estimate.\",\n bytes,\n gridIntensity: {\n description:\n \"The grid intensity (grams per kilowatt-hour) used to calculate this CO2 estimate.\",\n ...adjustments.gridIntensity,\n },\n ...otherVariables,\n },\n };\n }\n\n /**\n * Accept a figure in bytes for data transfer, a boolean for whether\n * the domain shows as 'green', and an options object.\n * Returns an object containing CO2 figure, green boolean, and object of the variables used in calculating the CO2 figure.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @param {Object} options\n * @return {CO2EstimateTraceResultPerVisit} the amount of CO2 in grammes\n */\n perVisitTrace(bytes, green = false, options = {}) {\n if (this.model?.perVisit) {\n const adjustments = parseOptions(options, this.model.version, green);\n const { gridIntensity, ...variables } = adjustments;\n\n return {\n co2: this.model.perVisit(\n bytes,\n green,\n this._segment,\n this._rating,\n adjustments\n ),\n green,\n variables: {\n description:\n \"Below are the variables used to calculate this CO2 estimate.\",\n bytes,\n gridIntensity: {\n description:\n \"The grid intensity (grams per kilowatt-hour) used to calculate this CO2 estimate.\",\n ...adjustments.gridIntensity,\n },\n ...variables,\n },\n };\n } else {\n throw new Error(\n `The perVisitTrace() method is not supported in the model you are using. Try using perByte() instead.\\nSee https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`\n );\n }\n }\n}\n\nexport { CO2 };\nexport default CO2;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6DA,kBAAoB;AACpB,uCAAmC;AACnC,uCAAmC;AAEnC,uBAGO;AACP,qBAA6B;AAE7B,MAAM,IAAI;AAAA,EACR,YAAY,SAAS;AACnB,SAAK,QAAQ,IAAI,yCAAuB;AAGxC,QAAI,oCAAS,WAAU,SAAS;AAC9B,WAAK,QAAQ,IAAI,oBAAQ;AAAA,IAC3B,WAAW,oCAAS,WAAU,OAAO;AACnC,WAAK,QAAQ,IAAI,yCAAuB;AACxC,UAAI,oCAAS,aAAY,GAAG;AAC1B,aAAK,QAAQ,IAAI,yCAAuB;AAAA,MAC1C;AAAA,IACF,WAAW,mCAAS,OAAO;AACzB,YAAM,IAAI,MACR,IAAI,QAAQ;AAAA,mHACd;AAAA,IACF;AAEA,QAAI,oCAAS,WAAU,OAAO,QAAQ,WAAW,WAAW;AAC1D,YAAM,IAAI,MACR;AAAA,qHACF;AAAA,IACF;AAGA,UAAM,eAAe,CAAC,CAAC,KAAK,MAAM;AAGlC,SAAK,WAAW,oCAAS,aAAY;AAErC,SAAK,UAAU,oCAAS,YAAW;AAGnC,QAAI,CAAC,gBAAgB,KAAK,SAAS;AACjC,YAAM,IAAI,MACR;AAAA,mHACF;AAAA,IACF;AAAA,EACF;AAAA,EAWA,QAAQ,OAAO,QAAQ,OAAO;AAC5B,WAAO,KAAK,MAAM,QAAQ,OAAO,OAAO,KAAK,UAAU,KAAK,OAAO;AAAA,EACrE;AAAA,EAWA,SAAS,OAAO,QAAQ,OAAO;AArIjC;AAsII,QAAI,WAAK,UAAL,mBAAY,UAAU;AACxB,aAAO,KAAK,MAAM,SAAS,OAAO,OAAO,KAAK,UAAU,KAAK,OAAO;AAAA,IACtE,OAAO;AACL,YAAM,IAAI,MACR;AAAA,qHACF;AAAA,IACF;AAAA,EACF;AAAA,EAYA,aAAa,OAAO,QAAQ,OAAO,UAAU,CAAC,GAAG;AAC/C,UAAM,cAAc,iCAAa,SAAS,KAAK,MAAM,SAAS,KAAK;AAGnE,UAAM,EAAE,kBAAkB,mBAAmB;AAC7C,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,SACG;AAAA,QACD;AACJ,WAAO;AAAA,MACL,KAAK,KAAK,MAAM,QACd,OACA,OACA,KAAK,UACL,KAAK,SACL,WACF;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACT,aACE;AAAA,QACF;AAAA,QACA,eAAe;AAAA,UACb,aACE;AAAA,UACF,GAAG,YAAY;AAAA,QACjB;AAAA,QACA,GAAG;AAAA,MACL;AAAA,IACF;AAAA,EACF;AAAA,EAYA,cAAc,OAAO,QAAQ,OAAO,UAAU,CAAC,GAAG;AArMpD;AAsMI,QAAI,WAAK,UAAL,mBAAY,UAAU;AACxB,YAAM,cAAc,iCAAa,SAAS,KAAK,MAAM,SAAS,KAAK;AACnE,YAAM,EAAE,kBAAkB,cAAc;AAExC,aAAO;AAAA,QACL,KAAK,KAAK,MAAM,SACd,OACA,OACA,KAAK,UACL,KAAK,SACL,WACF;AAAA,QACA;AAAA,QACA,WAAW;AAAA,UACT,aACE;AAAA,UACF;AAAA,UACA,eAAe;AAAA,YACb,aACE;AAAA,YACF,GAAG,YAAY;AAAA,UACjB;AAAA,UACA,GAAG;AAAA,QACL;AAAA,MACF;AAAA,IACF,OAAO;AACL,YAAM,IAAI,MACR;AAAA,qHACF;AAAA,IACF;AAAA,EACF;AACF;AAGA,IAAO,cAAQ;",
|
|
4
|
+
"sourcesContent": ["\"use strict\";\n\n/**\n * @typedef {Object} CO2EstimateTraceResultPerByte\n * @property {number|CO2EstimateComponentsPerByte} co2 - The CO2 estimate in grams or its separate components\n * @property {boolean} green - Whether the domain is green or not\n * @property {TraceResultVariablesPerByte} variables - The variables used to calculate the CO2 estimate\n */\n\n/**\n * @typedef {Object} CO2EstimateTraceResultPerVisit\n * @property {number|CO2EstimateComponentsPerVisit} co2 - The CO2 estimate in grams or its separate components\n * @property {boolean} green - Whether the domain is green or not\n * @property {TraceResultVariablesPerVisit} variables - The variables used to calculate the CO2 estimate\n */\n\n/**\n * @typedef {Object} TraceResultVariablesPerByte\n * @property {GridIntensityVariables} gridIntensity - The grid intensity related variables\n */\n/**\n * @typedef {Object} TraceResultVariablesPerVisit\n * @property {GridIntensityVariables} gridIntensity - The grid intensity related variables\n * @property {number} dataReloadRatio - What percentage of a page is reloaded on each subsequent page view\n * @property {number} firstVisitPercentage - What percentage of visits are loading this page for subsequent times\n * @property {number} returnVisitPercentage - What percentage of visits are loading this page for the second or more time\n */\n\n/**\n * @typedef {Object} GridIntensityVariables\n * @property {string} description - The description of the variables\n * @property {number} network - The network grid intensity set by the user or the default\n * @property {number} dataCenter - The data center grid intensity set by the user or the default\n * @property {number} device - The device grid intensity set by the user or the default\n * @property {number} production - The production grid intensity set by the user or the default\n */\n\n/**\n * @typedef {Object} CO2EstimateComponentsPerByte\n * @property {number} networkCO2 - The CO2 estimate for networking in grams\n * @property {number} dataCenterCO2 - The CO2 estimate for data centers in grams\n * @property {number} consumerDeviceCO2 - The CO2 estimate for consumer devices in grams\n * @property {number} productionCO2 - The CO2 estimate for device production in grams\n * @property {string} rating - The rating of the CO2 estimate based on the Sustainable Web Design Model\n * @property {number} total - The total CO2 estimate in grams\n */\n\n/**\n * @typedef {Object} CO2EstimateComponentsPerVisit\n * @property {number} 'networkCO2 - first' - The CO2 estimate for networking in grams on first visit\n * @property {number} 'networkCO2 - subsequent' - The CO2 estimate for networking in grams on subsequent visits\n * @property {number} 'dataCenterCO2 - first' - The CO2 estimate for data centers in grams on first visit\n * @property {number} 'dataCenterCO2 - subsequent' - The CO2 estimate for data centers in grams on subsequent visits\n * @property {number} 'consumerDeviceCO2 - first' - The CO2 estimate for consumer devices in grams on first visit\n * @property {number} 'consumerDeviceCO2 - subsequent' - The CO2 estimate for consumer devices in grams on subsequent visits\n * @property {number} 'productionCO2 - first' - The CO2 estimate for device production in grams on first visit\n * @property {number} 'productionCO2 - subsequent' - The CO2 estimate for device production in grams on subsequent visits\n * @property {string} rating - The rating of the CO2 estimate based on the Sustainable Web Design Model\n * @property {number} total - The total CO2 estimate in grams\n */\n\nimport OneByte from \"./1byte.js\";\nimport SustainableWebDesignV3 from \"./sustainable-web-design-v3.js\";\nimport SustainableWebDesignV4 from \"./sustainable-web-design-v4.js\";\n\nimport {\n GLOBAL_GRID_INTENSITY,\n RENEWABLES_GRID_INTENSITY,\n} from \"./constants/index.js\";\nimport { parseOptions } from \"./helpers/index.js\";\n\nclass CO2 {\n constructor(options) {\n this.model = new SustainableWebDesignV3();\n // Using optional chaining allows an empty object to be passed\n // in without breaking the code.\n if (options?.model === \"1byte\") {\n this.model = new OneByte();\n } else if (options?.model === \"swd\") {\n this.model = new SustainableWebDesignV3();\n if (options?.version === 4) {\n this.model = new SustainableWebDesignV4();\n }\n } else if (options?.model) {\n throw new Error(\n `\"${options.model}\" is not a valid model. Please use \"1byte\" for the OneByte model, and \"swd\" for the Sustainable Web Design model.\\nSee https://developers.thegreenwebfoundation.org/co2js/models/ to learn more about the models available in CO2.js.`\n );\n }\n\n if (options?.rating && typeof options.rating !== \"boolean\") {\n throw new Error(\n `The rating option must be a boolean. Please use true or false.\\nSee https://developers.thegreenwebfoundation.org/co2js/options/ to learn more about the options available in CO2.js.`\n );\n }\n\n // This flag checks to see if the model itself has a rating system.\n const allowRatings = !!this.model.allowRatings;\n\n /** @private */\n this._segment = options?.results === \"segment\";\n // This flag is set by the user to enable the rating system.\n this._rating = options?.rating === true;\n\n // The rating system is only supported in the Sustainable Web Design Model.\n if (!allowRatings && this._rating) {\n throw new Error(\n `The rating system is not supported in the model you are using. Try using the Sustainable Web Design model instead.\\nSee https://developers.thegreenwebfoundation.org/co2js/models/ to learn more about the models available in CO2.js.`\n );\n }\n }\n\n /**\n * Accept a figure in bytes for data transfer, and a boolean for whether\n * the domain shows as 'green', and return a CO2 figure for energy used to shift the corresponding\n * the data transfer.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @return {number|CO2EstimateComponentsPerByte} the amount of CO2 in grammes or its separate components\n */\n perByte(bytes, green = false) {\n return this.model.perByte(bytes, green, this._segment, this._rating);\n }\n\n /**\n * Accept a figure in bytes for data transfer, and a boolean for whether\n * the domain shows as 'green', and return a CO2 figure for energy used to shift the corresponding\n * the data transfer.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @return {number|CO2EstimateComponentsPerVisit} the amount of CO2 in grammes or its separate components\n */\n perVisit(bytes, green = false) {\n if (this.model?.perVisit) {\n return this.model.perVisit(bytes, green, this._segment, this._rating);\n } else {\n throw new Error(\n `The perVisit() method is not supported in the model you are using. Try using perByte() instead.\\nSee https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`\n );\n }\n }\n\n /**\n * Accept a figure in bytes for data transfer, a boolean for whether\n * the domain shows as 'green', and an options object.\n * Returns an object containing CO2 figure, green boolean, and object of the variables used in calculating the CO2 figure.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @param {Object} options\n * @return {CO2EstimateTraceResultPerByte} the amount of CO2 in grammes\n */\n perByteTrace(bytes, green = false, options = {}) {\n const adjustments = parseOptions(options, this.model.version, green);\n\n // Filter out the trace items that aren't relevant to this function.\n const { gridIntensity, ...traceVariables } = adjustments;\n const {\n dataReloadRatio,\n firstVisitPercentage,\n returnVisitPercentage,\n ...otherVariables\n } = traceVariables;\n return {\n co2: this.model.perByte(\n bytes,\n green,\n this._segment,\n this._rating,\n adjustments\n ),\n green,\n variables: {\n description:\n \"Below are the variables used to calculate this CO2 estimate.\",\n bytes,\n gridIntensity: {\n description:\n \"The grid intensity (grams per kilowatt-hour) used to calculate this CO2 estimate.\",\n ...adjustments.gridIntensity,\n },\n ...otherVariables,\n },\n };\n }\n\n /**\n * Accept a figure in bytes for data transfer, a boolean for whether\n * the domain shows as 'green', and an options object.\n * Returns an object containing CO2 figure, green boolean, and object of the variables used in calculating the CO2 figure.\n *\n * @param {number} bytes\n * @param {boolean} green\n * @param {Object} options\n * @return {CO2EstimateTraceResultPerVisit} the amount of CO2 in grammes\n */\n perVisitTrace(bytes, green = false, options = {}) {\n if (this.model?.perVisit) {\n const adjustments = parseOptions(options, this.model.version, green);\n const { gridIntensity, ...variables } = adjustments;\n\n return {\n co2: this.model.perVisit(\n bytes,\n green,\n this._segment,\n this._rating,\n adjustments\n ),\n green,\n variables: {\n description:\n \"Below are the variables used to calculate this CO2 estimate.\",\n bytes,\n gridIntensity: {\n description:\n \"The grid intensity (grams per kilowatt-hour) used to calculate this CO2 estimate.\",\n ...adjustments.gridIntensity,\n },\n ...variables,\n },\n };\n } else {\n throw new Error(\n `The perVisitTrace() method is not supported in the model you are using. Try using perByte() instead.\\nSee https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`\n );\n }\n }\n\n SustainableWebDesignV3() {\n return new SustainableWebDesignV3();\n }\n\n SustainableWebDesignV4() {\n return new SustainableWebDesignV4();\n }\n\n OneByte() {\n return new OneByte();\n }\n}\n\nexport { CO2 };\nexport default CO2;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA6DA,kBAAoB;AACpB,uCAAmC;AACnC,uCAAmC;AAEnC,uBAGO;AACP,qBAA6B;AAE7B,MAAM,IAAI;AAAA,EACR,YAAY,SAAS;AACnB,SAAK,QAAQ,IAAI,yCAAuB;AAGxC,QAAI,oCAAS,WAAU,SAAS;AAC9B,WAAK,QAAQ,IAAI,oBAAQ;AAAA,IAC3B,WAAW,oCAAS,WAAU,OAAO;AACnC,WAAK,QAAQ,IAAI,yCAAuB;AACxC,UAAI,oCAAS,aAAY,GAAG;AAC1B,aAAK,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;AAAA,EAYA,cAAc,OAAO,QAAQ,OAAO,UAAU,CAAC,GAAG;AArMpD;AAsMI,QAAI,WAAK,UAAL,mBAAY,UAAU;AACxB,YAAM,cAAc,iCAAa,SAAS,KAAK,MAAM,SAAS,KAAK;AACnE,YAAM,EAAE,kBAAkB,cAAc;AAExC,aAAO;AAAA,QACL,KAAK,KAAK,MAAM,SACd,OACA,OACA,KAAK,UACL,KAAK,SACL,WACF;AAAA,QACA;AAAA,QACA,WAAW;AAAA,UACT,aACE;AAAA,UACF;AAAA,UACA,eAAe;AAAA,YACb,aACE;AAAA,YACF,GAAG,YAAY;AAAA,UACjB;AAAA,UACA,GAAG;AAAA,QACL;AAAA,MACF;AAAA,IACF,OAAO;AACL,YAAM,IAAI,MACR;AAAA,qHACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,yBAAyB;AACvB,WAAO,IAAI,yCAAuB;AAAA,EACpC;AAAA,EAEA,yBAAyB;AACvB,WAAO,IAAI,yCAAuB;AAAA,EACpC;AAAA,EAEA,UAAU;AACR,WAAO,IAAI,oBAAQ;AAAA,EACrB;AACF;AAGA,IAAO,cAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,7 +22,7 @@ __export(average_intensities_min_exports, {
|
|
|
22
22
|
type: () => type
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(average_intensities_min_exports);
|
|
25
|
-
const data = { "AFG": 132.53, "AFRICA":
|
|
25
|
+
const data = { "AFG": 132.53, "AFRICA": 547.83, "ALB": 24.29, "DZA": 634.61, "ASM": 611.11, "AGO": 174.73, "ATG": 611.11, "ARG": 353.96, "ARM": 264.54, "ABW": 561.22, "ASEAN": 570.41, "ASIA": 591.13, "AUS": 556.3, "AUT": 110.81, "AZE": 671.39, "BHS": 660.1, "BHR": 904.62, "BGD": 691.41, "BRB": 605.51, "BLR": 441.74, "BEL": 138.11, "BLZ": 225.81, "BEN": 584.07, "BTN": 23.33, "BOL": 531.69, "BIH": 601.29, "BWA": 847.91, "BRA": 96.4, "BRN": 893.91, "BGR": 335.33, "BFA": 467.53, "BDI": 250, "CPV": 558.14, "KHM": 417.71, "CMR": 305.42, "CAN": 165.15, "CYM": 642.86, "CAF": 0, "TCD": 628.57, "CHL": 291.11, "CHN": 583.61, "COL": 259.51, "COM": 642.86, "COG": 700, "COD": 24.46, "COK": 250, "CRI": 53.38, "CIV": 393.89, "HRV": 204.96, "CUB": 637.61, "CYP": 534.32, "CZE": 449.72, "DNK": 151.65, "DJI": 692.31, "DMA": 529.41, "DOM": 580.78, "ECU": 166.91, "EGY": 574.04, "SLV": 224.76, "GNQ": 591.84, "ERI": 631.58, "EST": 416.67, "SWZ": 172.41, "ETH": 24.64, "EU": 243.93, "EUROPE": 302.29, "FLK": 500, "FRO": 404.76, "FJI": 288.46, "FIN": 79.16, "FRA": 56.02, "GUF": 217.82, "PYF": 442.86, "G20": 477.89, "G7": 341.44, "GAB": 491.6, "GMB": 666.67, "GEO": 167.59, "DEU": 381.41, "GHA": 484, "GRC": 336.57, "GRL": 178.57, "GRD": 640, "GLP": 500, "GUM": 622.86, "GTM": 328.27, "GIN": 236.84, "GNB": 625, "GUY": 640.35, "HTI": 567.31, "HND": 282.27, "HKG": 699.5, "HUN": 204.19, "ISL": 27.68, "IND": 713.01, "IDN": 682.43, "IRN": 641.73, "IRQ": 688.81, "IRL": 282.98, "ISR": 582.93, "ITA": 330.72, "JAM": 555.56, "JPN": 493.59, "JOR": 540.92, "KAZ": 821.9, "KEN": 71.2, "KIR": 666.67, "XKX": 894.65, "KWT": 649.16, "KGZ": 147.29, "LAO": 265.51, "LATIN AMERICA AND CARIBBEAN": 256.03, "LVA": 123.99, "LBN": 599.01, "LSO": 20, "LBR": 227.85, "LBY": 818.69, "LTU": 160.07, "LUX": 105.26, "MAC": 448.98, "MDG": 436.44, "MWI": 66.67, "MYS": 607.88, "MDV": 611.77, "MLI": 408, "MLT": 459.14, "MTQ": 523.18, "MRT": 464.71, "MUS": 632.48, "MEX": 492.34, "MIDDLE EAST": 643.04, "MDA": 643.46, "MNG": 775.31, "MNE": 418.09, "MSR": 1e3, "MAR": 624.45, "MOZ": 135.65, "MMR": 436.92, "NAM": 59.26, "NRU": 750, "NPL": 24.44, "NLD": 268.48, "NCL": 660.58, "NZL": 112.76, "NIC": 265.12, "NER": 670.89, "NGA": 523.25, "NORTH AMERICA": 342.95, "PRK": 389.59, "MKD": 556.19, "NOR": 30.05, "OCEANIA": 495.74, "OECD": 341.27, "OMN": 564.55, "PAK": 440.61, "PSE": 516.13, "PAN": 161.68, "PNG": 507.25, "PRY": 24.31, "PER": 266.48, "POL": 661.93, "PRT": 165.55, "PRI": 677.96, "QAT": 602.5, "REU": 572.82, "ROU": 240.58, "RUS": 445.02, "RWA": 316.33, "KNA": 636.36, "LCA": 666.67, "SPM": 600, "VCT": 529.41, "WSM": 473.68, "STP": 642.86, "SAU": 696.31, "SEN": 511.6, "SRB": 647.52, "SYC": 564.52, "SLE": 50, "SGP": 470.78, "SVK": 116.77, "SVN": 231.28, "SLB": 700, "SOM": 578.95, "ZAF": 709.69, "KOR": 432.11, "SSD": 629.03, "ESP": 174.05, "LKA": 509.78, "SDN": 263.16, "SUR": 349.28, "SWE": 40.7, "CHE": 34.68, "SYR": 701.66, "TWN": 644.36, "TJK": 116.86, "TZA": 339.25, "THA": 549.85, "PHL": 610.74, "TGO": 443.18, "TON": 625, "TTO": 681.53, "TUN": 563.96, "TUR": 464.59, "TKM": 1306.03, "TCA": 653.85, "UGA": 44.53, "UKR": 256.21, "ARE": 492.7, "GBR": 228.25, "USA": 369.47, "URY": 128.79, "UZB": 1167.6, "VUT": 571.43, "VEN": 185.8, "VNM": 472.47, "VGB": 647.06, "VIR": 632.35, "WORLD": 481.65, "YEM": 566.1, "ZMB": 111.97, "ZWE": 297.87 };
|
|
26
26
|
const type = "average";
|
|
27
27
|
var average_intensities_min_default = { data, type };
|
|
28
28
|
//# sourceMappingURL=average-intensities.min.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/data/average-intensities.min.js"],
|
|
4
|
-
"sourcesContent": ["const data = {\"AFG\":132.53,\"AFRICA\":
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,OAAO,EAAC,OAAM,QAAO,UAAS,QAAO,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,
|
|
4
|
+
"sourcesContent": ["const data = {\"AFG\":132.53,\"AFRICA\":547.83,\"ALB\":24.29,\"DZA\":634.61,\"ASM\":611.11,\"AGO\":174.73,\"ATG\":611.11,\"ARG\":353.96,\"ARM\":264.54,\"ABW\":561.22,\"ASEAN\":570.41,\"ASIA\":591.13,\"AUS\":556.3,\"AUT\":110.81,\"AZE\":671.39,\"BHS\":660.1,\"BHR\":904.62,\"BGD\":691.41,\"BRB\":605.51,\"BLR\":441.74,\"BEL\":138.11,\"BLZ\":225.81,\"BEN\":584.07,\"BTN\":23.33,\"BOL\":531.69,\"BIH\":601.29,\"BWA\":847.91,\"BRA\":96.4,\"BRN\":893.91,\"BGR\":335.33,\"BFA\":467.53,\"BDI\":250,\"CPV\":558.14,\"KHM\":417.71,\"CMR\":305.42,\"CAN\":165.15,\"CYM\":642.86,\"CAF\":0,\"TCD\":628.57,\"CHL\":291.11,\"CHN\":583.61,\"COL\":259.51,\"COM\":642.86,\"COG\":700,\"COD\":24.46,\"COK\":250,\"CRI\":53.38,\"CIV\":393.89,\"HRV\":204.96,\"CUB\":637.61,\"CYP\":534.32,\"CZE\":449.72,\"DNK\":151.65,\"DJI\":692.31,\"DMA\":529.41,\"DOM\":580.78,\"ECU\":166.91,\"EGY\":574.04,\"SLV\":224.76,\"GNQ\":591.84,\"ERI\":631.58,\"EST\":416.67,\"SWZ\":172.41,\"ETH\":24.64,\"EU\":243.93,\"EUROPE\":302.29,\"FLK\":500,\"FRO\":404.76,\"FJI\":288.46,\"FIN\":79.16,\"FRA\":56.02,\"GUF\":217.82,\"PYF\":442.86,\"G20\":477.89,\"G7\":341.44,\"GAB\":491.6,\"GMB\":666.67,\"GEO\":167.59,\"DEU\":381.41,\"GHA\":484,\"GRC\":336.57,\"GRL\":178.57,\"GRD\":640,\"GLP\":500,\"GUM\":622.86,\"GTM\":328.27,\"GIN\":236.84,\"GNB\":625,\"GUY\":640.35,\"HTI\":567.31,\"HND\":282.27,\"HKG\":699.5,\"HUN\":204.19,\"ISL\":27.68,\"IND\":713.01,\"IDN\":682.43,\"IRN\":641.73,\"IRQ\":688.81,\"IRL\":282.98,\"ISR\":582.93,\"ITA\":330.72,\"JAM\":555.56,\"JPN\":493.59,\"JOR\":540.92,\"KAZ\":821.9,\"KEN\":71.2,\"KIR\":666.67,\"XKX\":894.65,\"KWT\":649.16,\"KGZ\":147.29,\"LAO\":265.51,\"LATIN AMERICA AND CARIBBEAN\":256.03,\"LVA\":123.99,\"LBN\":599.01,\"LSO\":20,\"LBR\":227.85,\"LBY\":818.69,\"LTU\":160.07,\"LUX\":105.26,\"MAC\":448.98,\"MDG\":436.44,\"MWI\":66.67,\"MYS\":607.88,\"MDV\":611.77,\"MLI\":408,\"MLT\":459.14,\"MTQ\":523.18,\"MRT\":464.71,\"MUS\":632.48,\"MEX\":492.34,\"MIDDLE EAST\":643.04,\"MDA\":643.46,\"MNG\":775.31,\"MNE\":418.09,\"MSR\":1000,\"MAR\":624.45,\"MOZ\":135.65,\"MMR\":436.92,\"NAM\":59.26,\"NRU\":750,\"NPL\":24.44,\"NLD\":268.48,\"NCL\":660.58,\"NZL\":112.76,\"NIC\":265.12,\"NER\":670.89,\"NGA\":523.25,\"NORTH AMERICA\":342.95,\"PRK\":389.59,\"MKD\":556.19,\"NOR\":30.05,\"OCEANIA\":495.74,\"OECD\":341.27,\"OMN\":564.55,\"PAK\":440.61,\"PSE\":516.13,\"PAN\":161.68,\"PNG\":507.25,\"PRY\":24.31,\"PER\":266.48,\"POL\":661.93,\"PRT\":165.55,\"PRI\":677.96,\"QAT\":602.5,\"REU\":572.82,\"ROU\":240.58,\"RUS\":445.02,\"RWA\":316.33,\"KNA\":636.36,\"LCA\":666.67,\"SPM\":600,\"VCT\":529.41,\"WSM\":473.68,\"STP\":642.86,\"SAU\":696.31,\"SEN\":511.6,\"SRB\":647.52,\"SYC\":564.52,\"SLE\":50,\"SGP\":470.78,\"SVK\":116.77,\"SVN\":231.28,\"SLB\":700,\"SOM\":578.95,\"ZAF\":709.69,\"KOR\":432.11,\"SSD\":629.03,\"ESP\":174.05,\"LKA\":509.78,\"SDN\":263.16,\"SUR\":349.28,\"SWE\":40.7,\"CHE\":34.68,\"SYR\":701.66,\"TWN\":644.36,\"TJK\":116.86,\"TZA\":339.25,\"THA\":549.85,\"PHL\":610.74,\"TGO\":443.18,\"TON\":625,\"TTO\":681.53,\"TUN\":563.96,\"TUR\":464.59,\"TKM\":1306.03,\"TCA\":653.85,\"UGA\":44.53,\"UKR\":256.21,\"ARE\":492.7,\"GBR\":228.25,\"USA\":369.47,\"URY\":128.79,\"UZB\":1167.6,\"VUT\":571.43,\"VEN\":185.8,\"VNM\":472.47,\"VGB\":647.06,\"VIR\":632.35,\"WORLD\":481.65,\"YEM\":566.1,\"ZMB\":111.97,\"ZWE\":297.87}; const type = \"average\"; export { data, type }; export default { data, type };"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAAM,OAAO,EAAC,OAAM,QAAO,UAAS,QAAO,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,SAAQ,QAAO,QAAO,QAAO,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,OAAM,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,OAAM,QAAO,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,EAAE,MAAM,KAAK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -204,7 +204,7 @@ Falling back to default value.`);
|
|
|
204
204
|
return adjustments;
|
|
205
205
|
}
|
|
206
206
|
function getApiRequestHeaders(comment = "") {
|
|
207
|
-
return { "User-Agent": `co2js/${"0.16.
|
|
207
|
+
return { "User-Agent": `co2js/${"0.16.1"} ${comment}` };
|
|
208
208
|
}
|
|
209
209
|
function outputRating(co2e, swdmVersion) {
|
|
210
210
|
let {
|
package/dist/cjs/hosting.js
CHANGED
|
@@ -28,7 +28,5 @@ var import_hosting_api = __toESM(require("./hosting-api.js"));
|
|
|
28
28
|
function check(domain, optionsOrAgentId) {
|
|
29
29
|
return import_hosting_api.default.check(domain, optionsOrAgentId);
|
|
30
30
|
}
|
|
31
|
-
var hosting_default =
|
|
32
|
-
check
|
|
33
|
-
};
|
|
31
|
+
var hosting_default = check;
|
|
34
32
|
//# sourceMappingURL=hosting.js.map
|
package/dist/cjs/hosting.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/hosting.js"],
|
|
4
|
-
"sourcesContent": ["\"use strict\";\n\nimport hostingAPI from \"./hosting-api.js\";\n\n/**\n * Check if a domain is hosted by a green web host.\n * @param {string|array} domain - The domain to check, or an array of domains to be checked.\n * @param {string} optionsOrAgentId - Optional. An object of domain check options, or a string\n * representing the app, site, or organisation that is making the request.\n * @returns - A boolean if a string was provided, or an array of booleans if an array of domains was provided.\n * if a string was provided for `domain`: a boolean indicating whether the domain is hosted by a green web host if `options.verbose` is false,\n * otherwise an object representing the domain host information.\n * if an array was provided for `domain`: an array of domains that are hosted by a green web host if `options.verbose` is false,\n * otherwise a dictionary of domain to host information.\n */\nfunction check(domain, optionsOrAgentId) {\n return hostingAPI.check(domain, optionsOrAgentId);\n}\n\nexport default
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAAuB;
|
|
4
|
+
"sourcesContent": ["\"use strict\";\n\nimport hostingAPI from \"./hosting-api.js\";\n\n/**\n * @module hosting\n */\n\n/**\n * Check if a domain is hosted by a green web host.\n * @param {string|array} domain - The domain to check, or an array of domains to be checked.\n * @param {string} optionsOrAgentId - Optional. An object of domain check options, or a string\n * representing the app, site, or organisation that is making the request.\n * @returns - A boolean if a string was provided, or an array of booleans if an array of domains was provided.\n * if a string was provided for `domain`: a boolean indicating whether the domain is hosted by a green web host if `options.verbose` is false,\n * otherwise an object representing the domain host information.\n * if an array was provided for `domain`: an array of domains that are hosted by a green web host if `options.verbose` is false,\n * otherwise a dictionary of domain to host information.\n */\nfunction check(domain, optionsOrAgentId) {\n return hostingAPI.check(domain, optionsOrAgentId);\n}\n\nexport default check;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,yBAAuB;AAiBvB,eAAe,QAAQ,kBAAkB;AACvC,SAAO,2BAAW,MAAM,QAAQ,gBAAgB;AAClD;AAEA,IAAO,kBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/co2.js
CHANGED
|
@@ -118,6 +118,15 @@ See https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more ab
|
|
|
118
118
|
See https://developers.thegreenwebfoundation.org/co2js/methods/ to learn more about the methods available in CO2.js.`);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
+
SustainableWebDesignV3() {
|
|
122
|
+
return new SustainableWebDesignV3();
|
|
123
|
+
}
|
|
124
|
+
SustainableWebDesignV4() {
|
|
125
|
+
return new SustainableWebDesignV4();
|
|
126
|
+
}
|
|
127
|
+
OneByte() {
|
|
128
|
+
return new OneByte();
|
|
129
|
+
}
|
|
121
130
|
}
|
|
122
131
|
var co2_default = CO2;
|
|
123
132
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const data = { "AFG": 132.53, "AFRICA":
|
|
1
|
+
const data = { "AFG": 132.53, "AFRICA": 547.83, "ALB": 24.29, "DZA": 634.61, "ASM": 611.11, "AGO": 174.73, "ATG": 611.11, "ARG": 353.96, "ARM": 264.54, "ABW": 561.22, "ASEAN": 570.41, "ASIA": 591.13, "AUS": 556.3, "AUT": 110.81, "AZE": 671.39, "BHS": 660.1, "BHR": 904.62, "BGD": 691.41, "BRB": 605.51, "BLR": 441.74, "BEL": 138.11, "BLZ": 225.81, "BEN": 584.07, "BTN": 23.33, "BOL": 531.69, "BIH": 601.29, "BWA": 847.91, "BRA": 96.4, "BRN": 893.91, "BGR": 335.33, "BFA": 467.53, "BDI": 250, "CPV": 558.14, "KHM": 417.71, "CMR": 305.42, "CAN": 165.15, "CYM": 642.86, "CAF": 0, "TCD": 628.57, "CHL": 291.11, "CHN": 583.61, "COL": 259.51, "COM": 642.86, "COG": 700, "COD": 24.46, "COK": 250, "CRI": 53.38, "CIV": 393.89, "HRV": 204.96, "CUB": 637.61, "CYP": 534.32, "CZE": 449.72, "DNK": 151.65, "DJI": 692.31, "DMA": 529.41, "DOM": 580.78, "ECU": 166.91, "EGY": 574.04, "SLV": 224.76, "GNQ": 591.84, "ERI": 631.58, "EST": 416.67, "SWZ": 172.41, "ETH": 24.64, "EU": 243.93, "EUROPE": 302.29, "FLK": 500, "FRO": 404.76, "FJI": 288.46, "FIN": 79.16, "FRA": 56.02, "GUF": 217.82, "PYF": 442.86, "G20": 477.89, "G7": 341.44, "GAB": 491.6, "GMB": 666.67, "GEO": 167.59, "DEU": 381.41, "GHA": 484, "GRC": 336.57, "GRL": 178.57, "GRD": 640, "GLP": 500, "GUM": 622.86, "GTM": 328.27, "GIN": 236.84, "GNB": 625, "GUY": 640.35, "HTI": 567.31, "HND": 282.27, "HKG": 699.5, "HUN": 204.19, "ISL": 27.68, "IND": 713.01, "IDN": 682.43, "IRN": 641.73, "IRQ": 688.81, "IRL": 282.98, "ISR": 582.93, "ITA": 330.72, "JAM": 555.56, "JPN": 493.59, "JOR": 540.92, "KAZ": 821.9, "KEN": 71.2, "KIR": 666.67, "XKX": 894.65, "KWT": 649.16, "KGZ": 147.29, "LAO": 265.51, "LATIN AMERICA AND CARIBBEAN": 256.03, "LVA": 123.99, "LBN": 599.01, "LSO": 20, "LBR": 227.85, "LBY": 818.69, "LTU": 160.07, "LUX": 105.26, "MAC": 448.98, "MDG": 436.44, "MWI": 66.67, "MYS": 607.88, "MDV": 611.77, "MLI": 408, "MLT": 459.14, "MTQ": 523.18, "MRT": 464.71, "MUS": 632.48, "MEX": 492.34, "MIDDLE EAST": 643.04, "MDA": 643.46, "MNG": 775.31, "MNE": 418.09, "MSR": 1e3, "MAR": 624.45, "MOZ": 135.65, "MMR": 436.92, "NAM": 59.26, "NRU": 750, "NPL": 24.44, "NLD": 268.48, "NCL": 660.58, "NZL": 112.76, "NIC": 265.12, "NER": 670.89, "NGA": 523.25, "NORTH AMERICA": 342.95, "PRK": 389.59, "MKD": 556.19, "NOR": 30.05, "OCEANIA": 495.74, "OECD": 341.27, "OMN": 564.55, "PAK": 440.61, "PSE": 516.13, "PAN": 161.68, "PNG": 507.25, "PRY": 24.31, "PER": 266.48, "POL": 661.93, "PRT": 165.55, "PRI": 677.96, "QAT": 602.5, "REU": 572.82, "ROU": 240.58, "RUS": 445.02, "RWA": 316.33, "KNA": 636.36, "LCA": 666.67, "SPM": 600, "VCT": 529.41, "WSM": 473.68, "STP": 642.86, "SAU": 696.31, "SEN": 511.6, "SRB": 647.52, "SYC": 564.52, "SLE": 50, "SGP": 470.78, "SVK": 116.77, "SVN": 231.28, "SLB": 700, "SOM": 578.95, "ZAF": 709.69, "KOR": 432.11, "SSD": 629.03, "ESP": 174.05, "LKA": 509.78, "SDN": 263.16, "SUR": 349.28, "SWE": 40.7, "CHE": 34.68, "SYR": 701.66, "TWN": 644.36, "TJK": 116.86, "TZA": 339.25, "THA": 549.85, "PHL": 610.74, "TGO": 443.18, "TON": 625, "TTO": 681.53, "TUN": 563.96, "TUR": 464.59, "TKM": 1306.03, "TCA": 653.85, "UGA": 44.53, "UKR": 256.21, "ARE": 492.7, "GBR": 228.25, "USA": 369.47, "URY": 128.79, "UZB": 1167.6, "VUT": 571.43, "VEN": 185.8, "VNM": 472.47, "VGB": 647.06, "VIR": 632.35, "WORLD": 481.65, "YEM": 566.1, "ZMB": 111.97, "ZWE": 297.87 };
|
|
2
2
|
const type = "average";
|
|
3
3
|
var average_intensities_min_default = { data, type };
|
|
4
4
|
export {
|
|
@@ -186,7 +186,7 @@ Falling back to default value.`);
|
|
|
186
186
|
return adjustments;
|
|
187
187
|
}
|
|
188
188
|
function getApiRequestHeaders(comment = "") {
|
|
189
|
-
return { "User-Agent": `co2js/${"0.16.
|
|
189
|
+
return { "User-Agent": `co2js/${"0.16.1"} ${comment}` };
|
|
190
190
|
}
|
|
191
191
|
function outputRating(co2e, swdmVersion) {
|
|
192
192
|
let {
|
package/dist/esm/hosting.js
CHANGED
package/jsr.json
ADDED
package/mod.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index.js";
|