UNPKG

@golemio/energetics

Version:
25 lines 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PreCsvInputTransformation = void 0; const AbstractTransformation_1 = require("@golemio/core/dist/helpers/transformation/AbstractTransformation"); class PreCsvInputTransformation extends AbstractTransformation_1.AbstractTransformation { constructor() { super(...arguments); this.name = "PreCsvInputTransformation"; this.transformInternal = (data) => { const T1_Wh_raw_data = []; const ean = this.getEan(data[0]); for (const row of data) { const consumptionValue = row[Object.keys(row)[2]]; T1_Wh_raw_data.push([row["Konec intervalu"], parseInt(consumptionValue)]); } return { ean, T1_Wh_raw_data }; }; this.getEan = (data) => { const keys = Object.keys(data); return keys[2].substring(0, 18); }; } } exports.PreCsvInputTransformation = PreCsvInputTransformation; //# sourceMappingURL=PreCsvInputTransformation.js.map