2👍
✅
Maybe slightly more elegant:
const inputvalues = Object.entries(this.entries)
.map(([k, v]) => ([k, v.value]))
.reduce((res, [k, v]) => (v !== undefined && (res[k] = v), res), {});
Or a bit less functional:
const inputvalues = {};
for(const [key, obj] of Object.entries(this.entries))
if(obj.value !== undefined)
inputvalues[key] = obj.value;
Source:stackexchange.com