API Reference

Tranforms an array into an object with keys and values provided via callback function

function arrayInto<T extends any[]>(
  arr: T,
  fn: (item: T[number], index?: number) => object
)

// Example:

const arr = [{ first: "John", last: "Doe" }]

arrayInto(arr, (i) => ({[i.first]: i.last})) //=> { "John": "Doe" }