function Rx.where(w)assert(type(w)=="\102\117\110\099\116\105\111\110","\066\097\100 \112\114\101\100\105\099\097\116\101 \099\097\108\108\098\097\099\107")return function(n)assert(Observable.isObservable(n),"\066\097\100 \111\098\115\101\114\118\097\098\108\101")return Observable.new(function(a)return n:Subscribe(function(...)if w(...)then a:Fire(...)end end,a:GetFailComplete())end)end end
--[=[
	http://reactivex.io/documentation/operators/filter.html

	Filters out values

	```lua
	Rx.of(1, 2, 3, 4, 5):Pipe({
		Rx.where(function(value)
			return value % 2 == 0;
		end)
	}):Subscribe(print) --> 2, 4
	```
	@param predicate (value: T) -> boolean
	@return (source: Observable<T>) -> Observable<T>
]=]
function Rx.where(predicate)
	assert(type(predicate) == "function", "Bad predicate callback")

	return function(source)
		assert(Observable.isObservable(source), "Bad observable")

		return Observable.new(function(sub)
			return source:Subscribe(function(...)
				if predicate(...) then
					sub:Fire(...)
				end
			end, sub:GetFailComplete())
		end)
	end
end
