Cook
Execute array of callbacks
const iterate = (count, callback) =>
  [...Array(count)].map((_, i) => callback(i))
Generate empty array
const emptyArray = Array(5).fill(null)
Surgically remove one item from an array (no mutation)
    return [
        ...bigArray.slice(0, itemToRemoveIndex),
        ...bigArray.slice(itemToRemoveIndex + 1)
    ]
Surgically replace one item in an array
    return [
    ...bigArray.slice(0, itemToReplaceIndex),
        itemToInsert, 
        { ...array[itemToReplaceIndex], ...itemToInsert }, 
        ...bigArray.slice(itemToReplaceIndex + 1)
    ]
Move elements within array
function swapInArrayByIndex(arr, i1, i2){
    let t = arr[i1];
    arr[i1] = arr[i2];
    arr[i2] = t;
}
function moveBefore(arr, el){
    let ind = arr.indexOf(el);
    if(ind !== -1 && ind !== 0){
        swapInArrayByIndex(arr, ind, ind - 1);
    }
}
function moveAfter(arr, el){
    let ind = arr.indexOf(el);
    if(ind !== -1 && ind !== arr.length - 1){
        swapInArrayByIndex(arr, ind + 1, ind);
    }
}
Create a new, shallow-copied Array instance from an iterable or array-like object.
const eventsMap: Map = {
   "2023-03-02": [1, 2, 3] 
}
const eventsArray = Array.from(eventsMap, ([date, ids]) => ({ date, ids }));