Basic usage

Given an object and a mapping function, return an array with an item for each entry in the object.

import { listify } from 'radash'

const fish = {
  marlin: {
    weight: 105,
  },
  bass: {
    weight: 8,
  }
}

listify(fish, (key, value) => ({ ...value, name: key })) // => [{ name: 'marlin', weight: 105 }, { name: 'bass', weight: 8 }]

Testing

This _.listify function is 100% covered by tests. See them and contribute at GitHub.

Source

See the source for _.listify on GitHub.