addClimateRowToObject in NodeSQLite


#1

Can anyone explain this function used in “Node-SQLite” course topic: “db.each()

addClimateRowToObject (row, temperaturesByYear);

And the use of this line(Same Course)

const averageTemperatureByYear = calculateAverages(temperaturesByYear);
			printQueryResults(averageTemperatureByYear);

Thank you!


#2

(It’s been a long while since the question was posted but I came across it while searching for some other answer so I’m chippin in anyways, hope it helps if you havent found the answer already by now)

These functions are define in the ‘utils’ module. The names of the functions pretty much describe what they do. They don’t have any bearing on how the db.xxx() functions work.

addClimateRowtoObject adds the avg temp and year retrieved in db.each into an array object which it returns (as temperaturesByYear in this case).