Answers for "how to convert array to object in lodash"

0

how to convert array to object in lodash

var params = [
    { name: 'foo', input: 'bar' },
    { name: 'baz', input: 'zle' }
];

_.reduce(params , function(obj,param) {
 obj[param.name] = param.input
 return obj;
}, {});
Posted by: Guest on March-21-2021

Code answers related to "how to convert array to object in lodash"

Code answers related to "Javascript"

Browse Popular Code Answers by Language