Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 1x 1x 1x 1x 1x 1x 1x 1x | const { getComplementaryGESInfoAndDetails, getComplementaryWaterInfoAndDetails } = require("../utils"); const fs = require("fs"); module.exports = (result, options) => { const data = { score: result.ecoIndex, grade: result.grade, estimatation_co2: { ...getComplementaryGESInfoAndDetails(result.greenhouseGasesEmission, options), }, estimatation_water: { ...getComplementaryWaterInfoAndDetails(result.waterConsumption, options), }, pages: result.pages.map(page => { return { ...page, estimatation_co2: { ...getComplementaryGESInfoAndDetails(page.greenhouseGasesEmission, options), }, estimatation_water: { ...getComplementaryWaterInfoAndDetails(page.waterConsumption, options), } } }), }; const formattedJSON = JSON.stringify(data, null, 2); Iif (options.outputPath && options.outputPathDir) { fs.mkdirSync(options.outputPathDir, { recursive: true }); fs.writeFileSync(options.outputPath, formattedJSON); } console.log(formattedJSON); }; |