I have an array of objects like this:
const arr = [
{
question_Number: 205,
question_Text: "Enter Engine Number",
},
{
question_Number: 497,
question_Text: "Whether imported?",
},
{
question_Number: 547,
question_Text: "Whether goods are new?",
},
{
question_Number: 206,
question_Text: "Select Vehicle Condition",
},
];
and I want to transform it into an object of key/value pairs as this:
const result = {
205: {
type: "string",
title: "Enter Engine Number",
},
497: {
type: "string",
title: "Whether imported?",
},
547: {
type: "string",
title: "Whether imported goods are new?",
},
206: {
type: "string",
title: "Select Vehicle Condition",
},
};
How can I achieve this result using plain javascript or even lodash?
Thanks.
typeproperty is always "string"?