local ____exports = {}
local ____deepCopy = require("functions.deepCopy")
local deepCopy = ____deepCopy.deepCopy
local ____utils = require("functions.utils")
local ____repeat = ____utils["repeat"]
--- Initializes an array with all of the elements containing the specified default value.
-- 
-- The provided default value will be copied with the `deepCopy` function before adding it to the
-- new array. Thus, you can initialize an array of arrays, or an array of maps, and so on. (If the
-- `deepCopy` function was not used, then all of the array elements would just be references to the
-- same underlying data structure.)
-- 
-- For example:
-- 
-- ```ts
-- const arrayWithZeroes = newArray(0, 10); // Has 10 elements of 0.
-- const arrayWithArrays = newArray([0], 20); // Has 20 elements of an array with a 0 in it.
-- ```
function ____exports.newArray(self, defaultValue, size)
    local array = {}
    ____repeat(
        nil,
        size,
        function()
            local copy = deepCopy(nil, defaultValue)
            array[#array + 1] = copy
        end
    )
    return array
end
return ____exports
