Function listify

  • Type Parameters

    • TValue
    • TKey extends string | number | symbol
    • KResult

    Parameters

    Returns KResult[]

    Convert an object to a list, mapping each entry into a list item

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

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