Free Tailwind CSS components: yieldui.com

Building objects from nested arrays

If you have key-value-pairs in nested arrays, you can turn them into an object with Object.fromEntries().

const pairs = [
  ['name', 'Bob'],
  ['occupation', 'Fry cook'],
  ['shape', 'rectangular']
]

Object.fromEntries(pairs)
// ⇒ {
//     name: 'Bob',
//     occupation: 'Fry cook',
//     shape: 'rectangular'
//   }