Skip to content

Instantly share code, notes, and snippets.

View es6-map-to-object-literal.js
let map = new Map();
map.set("a", 1);
map.set("b", 2);
map.set("c", 3);
let obj = Array.from(map).reduce((obj, [key, value]) => (
Object.assign(obj, { [key]: value }) // Be careful! Maps can have non-String keys; object literals can't.
), {});
console.log(obj); // => { a: 1, b: 2, c: 3 }
View Aura Vision API - Time-segment structure example
{
"_id": "5b1a699283552d002516ac17",
"start": "2018-06-08T11:15:00.000Z",
"end": "2018-06-08T11:30:00.000Z",
"uptime": 1,
"data": {
"counts": {
"35-44male_1": 15,
"25-34male_3": 105,
"35-44female_3": 20,