ecoindex

1.0.5 • Public • Published

EcoIndex - JS

This project provides methods for the EcoIndex population.

It is based on the work of the association GreenIT and the web extension GreenIT-Analysis.

The sources are based on the initial Web Extension (https://github.com/cnumr/GreenIT-Analysis/blob/master/script/ecoIndex.js) code. The calculation method is discribed on here : (EcoIndex pouplation)

How to use ?

computeEcoIndex(dom, req, size)

computeEcoIndex returns the ecoIndex according to 3 parameters.

Parameters

Name Type Description
dom number Number of DOM elements
req number Number of requests
size number Size of response (Ko)

Example

import {computeEcoIndex} from "ecoindex";

const ecoIndex = computeEcoIndex(dom, req, size);

getEcoIndexGrade(ecoIndex)

getEcoIndexGrade returns the grade according to the ecoIndex value.

Parameters

Name Type Description
ecoIndex number The EcoIndex value

Example

import {computeEcoIndex, getEcoIndexGrade} from "ecoindex";

const ecoIndex = computeEcoIndex(dom, req, size);
const grade = getEcoIndexGrade(ecoIndex);

Testing

We use mocha for testing. You can launch tests using this command :

npm test

License

Disclaimer

The LCA values used by ecoindex to evaluate environmental impacts are not under free license - ©Frédéric Bordage
Please also refer to the mentions provided in the code files for specifics on the IP regime.

/ecoindex/

    Package Sidebar

    Install

    npm i ecoindex

    Weekly Downloads

    293

    Version

    1.0.5

    License

    CC-BY-NC-ND-3.0

    Unpacked Size

    33.3 kB

    Total Files

    11

    Last publish

    Collaborators

    • tsecher