API Reference

Returns a an object transformed into a new shape provided via callback function.

function objectInto<T extends object, K extends keyof T, V extends T[K]>(
  obj: T,
  fn: (key: K, val: V) => object
)

// Example:

const obj = { user: { id: 1, name: "Stephen", age: 39, sex: "M"} }

into(obj, (key, value) => ({[value.name]: `${value.age}/${value.sex}`}))

//=> { "Stephen": "39/M" }