Looked around but couldn't find an answer to this.
Is there a more declarative way of doing this with ramda?
R.reduce((acc, val) => {
acc[val.name] = val.value
return acc
}, {}, fields)
Basically, I am converting an array that looks like this:
[
{ name: "firstName", value: "John" },
{ name: "lastName", value: "Doe" }
]
Into a single object that looks like this:
{ firstName: "John", lastName: "Doe" }
const convert = (xs) => Object .fromEntries (xs .map (({name, value}) => [name, value]))