Question: Is it possible to download images to users local machines directly via Firebase functions? How to do it in case that:

1. Images are stored in Firebase storage.
2. Images are stored on other cloud storage providers (I can access them with url).

I don't want to download those images via url links so that I don't reveal the url the image is located on.

Answer: 
Do not create a new object every time.

```
const result = Object.values(orderResults.reduce((res, obj) => {
    res[obj.id] = res[obj.id] ||
    {   
        id: obj.id,
        total_amount : 0,
        name : obj.name,
    };
    res[obj.id].total_amount += obj.total_amount;
    res[obj.id]['sku' + obj.seq] = obj.sku;
    return res;
},[]))

```
```js
[{
    id: '1',
    name: 'Maya Mahardhani',
    payment_amount: 100,
    sku: 'ST001802027',
    seq: '1'
},
{
    id: '1',
    name: 'Maya Mahardhani',
    payment_amount: 50,
    sku: 'ST000703044',
    seq: '2'
},
{
    id: '2',
    name: 'Tara Debu Batara',
    payment_amount: 100,
    sku: 'ST005101001',
    seq: '1'
},
{
    id: '3',
    name: 'Nikita Gigir',
    payment_amount: 100,
    sku: 'ST004403030',
    seq: '1'
}].reduce((acc, current) => {
    const { id, name, payment_amount, sku, seq } = current;
    const previousRecord = acc[id];
    if (typeof previousRecord === 'object') {
        return {
            ...acc,
            [id]: {
                ...previousRecord,
                [`sku_${seq}`]: sku,
                total_amount: previousRecord.total_amount + payment_amount
            }
        }
    } else {

        return {
            ...acc,
            [id]: {
                id,
                name,
                [`sku_${seq}`]: sku,
                total_amount: payment_amount
            }
        }
    }
}, {}) // returns an Object; use Object.values to convert to a list

```