Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions composer/composer_transform_csv_to_json.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable func-style */
/* eslint-disable no-var */
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -19,8 +20,8 @@ module.exports = function main(
// [START composer_transform_csv_to_json]

function transformCSVtoJSON(line) {
const values = line.split(',');
const properties = [
var values = line.split(',');
var properties = [
'location',
'average_temperature',
'month',
Expand All @@ -30,13 +31,13 @@ module.exports = function main(
];
const weatherInCity = {};

for (let count = 0; count < values.length; count++) {
for (var count = 0; count < values.length; count++) {
if (values[count] !== 'null') {
weatherInCity[properties[count]] = values[count];
}
}

const jsonString = JSON.stringify(weatherInCity);
var jsonString = JSON.stringify(weatherInCity);
return jsonString;
}

Expand Down