local v={}function v.findFirstAncestor(v,E)assert(v)assert(typeof(E)=="\073\110\115\116\097\110\099\101")local F=E.Parent while F do local E=v:Get(F)if E then return E end F=F.Parent end return nil end function v.getChildren(v,E)assert(type(v)=="\116\097\098\108\101","\066\105\110\100\101\114 \109\117\115\116 \098\101 \098\105\110\100\101\114")assert(typeof(E)=="\073\110\115\116\097\110\099\101","\080\097\114\101\110\116 \112\097\114\097\109\101\116\101\114 \109\117\115\116 \098\101 \105\110\115\116\097\110\099\101")local F={}for E,N in pairs(E:GetChildren())do local Q=v:Get(N)if Q then table.insert(F,Q)end end return F end return v
--- Utility methods for binders
-- @module BinderUtil

local BinderUtil = {}

function BinderUtil.findFirstAncestor(binder, child)
	assert(binder)
	assert(typeof(child) == "Instance")

	local current = child.Parent
	while current do
		local class = binder:Get(current)
		if class then
			return class
		end
		current = current.Parent
	end
	return nil
end

function BinderUtil.getChildren(binder, parent)
	assert(type(binder) == "table", "Binder must be binder")
	assert(typeof(parent) == "Instance", "Parent parameter must be instance")

	local objects = {}
	for _, item in pairs(parent:GetChildren()) do
		local obj = binder:Get(item)
		if obj then
			table.insert(objects, obj)
		end
	end
	return objects
end

return BinderUtil