returning the item data from an array of objects

PHOTO EMBED

Thu Jan 30 2025 23:33:11 GMT+0000 (Coordinated Universal Time)

Saved by @davidmchale #data #object

 // this function is used to get the data we need for the html we want to render
    function getItemData(dataArray) {
        if (!dataArray) return [];

        return dataArray?.map((item) => ({
            name: item?.name ?? "",
            category: item?.category ?? "",
            web: item?.website ?? "",
            tel: item?.tel ?? "",
            email: item?.email ?? "",
        }));
    }
content_copyCOPY