i need to map an object like this
let obj = {
a : { value : 5, meta: "sss" },
b : { value : 1, meta: "rrr" },
a : { value : 6, meta: "nnn" },
}`
to obtain and object like this
{ a: 5, b: 1, c:6}
I can't get the "key" as a string.
I've tried:
let yyy = Object.keys(obj).map(function (key) {
return { key: obj[key].value };
});
But it produces an "Array" (while I need an Object) of {key : 5}...
with the string "key" instead of the name of the key.