local s=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local u=require(s.Packages.iter)return function()describe("\102\105\110\100\077\097\112",function()it("\115\104\111\117\108\100 \102\105\110\100 \116\104\101 \102\105\114\115\116 \110\111\110-\110\105\108",function()local s={"\108\111\108","\104\105","\050","\053"}local c,E=(u.new(s)):findMap(function(s,u)return tonumber(u)end);(expect(c)).to.be.equal(3);(expect(E)).to.be.equal(2)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \110\105\108 \105\102 \097\108\108 \097\114\101 \110\105\108",function()local s={"\108\111\108";"\104\105";"\050";"\053"}local c,E=(u.new(s)):findMap(function()return nil end);(expect(c)).to.be.equal(nil);(expect(E)).to.be.equal(nil)end)end)end
--!strict
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local iter = require(ReplicatedStorage.Packages.iter)

return function()
	describe("findMap", function()
		it("should find the first non-nil", function()
			local a = { "lol", "hi", "2", "5" }

			local i, firstNumber = iter.new(a):findMap(function(_, s)
				return tonumber(s)
			end)

			expect(i).to.be.equal(3)
			expect(firstNumber).to.be.equal(2)
		end)

		it("should return nil if all are nil", function()
			local a = { "lol", "hi", "2", "5" }

			local key, value = iter.new(a):findMap(function()
				return nil
			end)

			expect(key).to.be.equal(nil)
			expect(value).to.be.equal(nil)
		end)
	end)
end
