function Promise.is(A)if type(A)~="\116\097\098\108\101"then return false end local o=getmetatable(A)if o==Promise then return true elseif o==nil then return type(A.andThen)=="\102\117\110\099\116\105\111\110"elseif type(o)=="\116\097\098\108\101"and(type(rawget(o,"\095\095\105\110\100\101\120"))=="\116\097\098\108\101"and type(rawget(rawget(o,"\095\095\105\110\100\101\120"),"\097\110\100\084\104\101\110"))=="\102\117\110\099\116\105\111\110")then return true end return false end Promise.Is=Promise.is

function Promise.is(object)
	if type(object) ~= "table" then
		return false
	end

	local objectMetatable = getmetatable(object)

	if objectMetatable == Promise then
		-- The Promise came from this library.
		return true
	elseif objectMetatable == nil then
		-- No metatable, but we should still chain onto tables with andThen methods
		return type(object.andThen) == "function"
	elseif
		type(objectMetatable) == "table"
		and type(rawget(objectMetatable, "__index")) == "table"
		and type(rawget(rawget(objectMetatable, "__index"), "andThen")) == "function"
	then
		-- Maybe this came from a different or older Promise library.
		return true
	end

	return false
end
Promise.Is = Promise.is
