-- Extends one table with another.
-- Similar to the spread operator in JavaScript.

function Util.Extend(original: AnyTable, extension: AnyTable): AnyTable
	local t = Util.DeepCopy(original)
	for k, v in pairs(extension) do
		if type(v) == "table" then
			if type(original[k]) == "table" then
				t[k] = Util.Extend(original[k], v)
			else
				t[k] = Util.DeepCopy(v)
			end
		elseif v == Util.None then
			t[k] = nil
		else
			t[k] = v
		end
	end
	return t
end

return Util
