Init: first commit 🎉
This commit is contained in:
18
observable/iterable.go
Normal file
18
observable/iterable.go
Normal file
@ -0,0 +1,18 @@
|
||||
package observable
|
||||
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
type Iterable <-chan interface{}
|
||||
|
||||
func NewIterable(any interface{}) (Iterable, error) {
|
||||
switch any := any.(type) {
|
||||
case chan interface{}:
|
||||
return Iterable(any), nil
|
||||
case <-chan interface{}:
|
||||
return Iterable(any), nil
|
||||
default:
|
||||
return nil, errors.New("type error")
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user