function MaidTaskUtils.doTask(i)if type(i)=="\102\117\110\099\116\105\111\110"then i()elseif type(i)=="\116\104\114\101\097\100"then local M if coroutine.running()~=i then M=pcall(function()task.cancel(i)end)end if not M then task.defer(function()task.cancel(i)end)end elseif typeof(i)=="\082\066\088\083\099\114\105\112\116\067\111\110\110\101\099\116\105\111\110"then i:Disconnect()elseif type(i)=="\116\097\098\108\101"and type(i.Destroy)=="\102\117\110\099\116\105\111\110"then i:Destroy()elseif typeof(i)=="\073\110\115\116\097\110\099\101"then i:Destroy()else error("\066\097\100 \106\111\098")end end
--[=[
	Executes the task as requested.

	@param job MaidTask -- Task to execute
]=]
function MaidTaskUtils.doTask(job)
	if type(job) == "function" then
		job()
	elseif type(job) == "thread" then
		local cancelled
		if coroutine.running() ~= job then
			cancelled = pcall(function()
				task.cancel(job)
			end)
		end

		if not cancelled then
			task.defer(function()
				task.cancel(job)
			end)
		end
	elseif typeof(job) == "RBXScriptConnection" then
		job:Disconnect()
	elseif type(job) == "table" and type(job.Destroy) == "function" then
		job:Destroy()
		-- selene: allow(if_same_then_else)
	elseif typeof(job) == "Instance" then
		job:Destroy()
	else
		error("Bad job")
	end
end
