local w=require(script.Parent.Parent.Constants)local O=require(script.Parent.Parent.Parent.Shared.Util)local T={}function T.reference(w,O)return w~=O end function T.value(w,T)return not O.deepEquals(w,T)end function T.within(w)return function(O,T)return math.abs(O-T)>w end end function T.structure(w)return function(O,I)for q,B in ipairs({O;I})do for q in pairs(B)do if(w[q]or T.default)(O and O[q],I and I[q])then return true end end end return false end end T.near=T.within(w.COMPARATOR_NEAR_DEFAULT)T.default=T.reference return T
local Constants = require(script.Parent.Parent.Constants)
local Util = require(script.Parent.Parent.Parent.Shared.Util)

local Comparators = {}

function Comparators.reference(a, b)
	return a ~= b
end

function Comparators.value(a, b)
	return not Util.deepEquals(a, b)
end

function Comparators.within(epsilon)
	return function(a, b)
		return math.abs(a - b) > epsilon
	end
end

function Comparators.structure(propertyComparators)
	return function (a, b)
		for _, item in ipairs({a, b}) do
			for key in pairs(item) do
				if (propertyComparators[key] or Comparators.default)(a and a[key], b and b[key]) then
					return true
				end
			end
		end

		return false
	end
end

Comparators.near = Comparators.within(Constants.COMPARATOR_NEAR_DEFAULT)

Comparators.default = Comparators.reference

return Comparators
