So In my data I store it as shown on the first picture:

What I wanna do is so when I fetch const SourceData = await db.query("SELECT value,time from weather_data where weather_id = 1");
I wanna turn it into an object that is time as key and value as value("time": value).
So the object's first value would be "2018-06-05":12 for example.
The reason I wanna do this is since I am planning on using this in a geojson so it becomes something like this (https://raw.githubusercontent.com/uber/react-map-gl/master/examples/.data/us-income.geojson) when I combine this new object with this one. 
If anyone have any better ideas please say, if not please tell me how I make the key into value the most efficient!
I am using Node.
You can do this using reduce assuming sourceData is an array of objects with keys time and value:
const result = sourceData.reduce((acc, curr) => {
acc[curr.time] = curr.value;
return acc;
}, {})