function Rx.defaultsTo(W)return function(S)assert(Observable.isObservable(S),"\066\097\100 \111\098\115\101\114\118\097\098\108\101")return Observable.new(function(v)local G=Maid.new()local A=false G:GiveTask(S:Subscribe(function(...)A=true v:Fire(...)end,v:GetFailComplete()))if not A then v:Fire(W)end return G end)end end
--[=[
	Defaults the observable to a value if it isn't fired immediately

	```lua
	Rx.NEVER:Pipe({
		Rx.defaultsTo("Hello")
	}):Subscribe(print) --> Hello
	```

	@param value any
	@return (source: Observable) -> Observable
]=]
function Rx.defaultsTo(value)
	return function(source)
		assert(Observable.isObservable(source), "Bad observable")

		return Observable.new(function(sub)
			local maid = Maid.new()

			local fired = false

			maid:GiveTask(source:Subscribe(function(...)
				fired = true
				sub:Fire(...)
			end, sub:GetFailComplete()))

			if not fired then
				sub:Fire(value)
			end

			return maid
		end)
	end
end
