Convert Array of the object to Object
const arr = [{name: 'john'}, {name: 'chris'}, {name: 'sravan'}, {name: 'hoon'}];
const obj = arrayToMap(arr, 'name');
console.log(obj);
// {
// 'john': {name: 'john'},
// 'chris': {name: 'chris'},
// 'sravan': {name: 'sravan'},
// 'hoon': {name: 'hoon'}
// }
Convert Array of the object to Object
const arr = [{name: 'john'}, {name: 'chris'}, {name: 'sravan'}, {name: 'hoon'}];
const obj = arrayToMap(arr, 'name');
console.log(obj);
// {
// 'john': {name: 'john'},
// 'chris': {name: 'chris'},
// 'sravan': {name: 'sravan'},
// 'hoon': {name: 'hoon'}
// }
Generated using TypeDoc
Convert Array of the object to Object
Returns
Example