mihomo/observable/util.go

16 lines
257 B
Go
Raw Normal View History

2018-06-10 22:50:03 +08:00
package observable
func mergeWithBytes(ch <-chan interface{}, buf []byte) chan interface{} {
out := make(chan interface{})
go func() {
defer close(out)
if len(buf) != 0 {
out <- buf
}
for elm := range ch {
out <- elm
}
}()
return out
}