arr2object
v1.1.2
Published
A simple function that takes an array of strings and returns an object with the strings as keys and their index as the value
Downloads
1
Readme
Array to Object
Array to Object is a simple function that takes an array of strings and returns an object with the strings as keys and their index as the value.
Usage:
const array = [
{
id: 1,
name: 'Ram',
age: 25,
},
{
id: 2,
name: 'Shyam',
age: 30,
}
];
arrayToObject(array, 'id');
// Output
{
'1': 0,
'2': 1
}