--[=[
	Creates a shallow copy of an array, passed through a filter callback- if the callback returns false, the element is removed.
	
	```lua
	local str = {"a", "b", "c", "d", "e", "f", "g"}
	
	print(TableKit.Filter(str, function(value)
		return value > "c"
	end))
	-- prints {
 		[1] = "d",
 		[2] = "e",
 		[3] = "f",
 		[4] = "g"
 	}
	```

	@within TableKit
	@param arr { [number]: unknown }
	@param callback (value: value) -> boolean
	@return { [number]: unknown }
]=]

function TableKit.Filter<T>(arr: { [number]: T }, callback: (value: T) -> boolean)
	local tbl = {}

	for _, value in arr do
		if callback(value) then
			table.insert(tbl, value)
		end
	end

	return tbl
end
