diff --git a/of.go b/of.go index 11959fb..e3a2f4c 100644 --- a/of.go +++ b/of.go @@ -70,8 +70,8 @@ func OfMap[K comparable, V, T any](m map[K]V, unmapper func(K, V) T) <-chan T { } // OfSeq returns a channel containing all values provided by the iterator -func OfSeq[T any](seq iter.Seq[T]) <-chan T { - out := make(chan T, 10) +func OfSeq[T any](seq iter.Seq[T], buffer int) <-chan T { + out := make(chan T, buffer) go func() { defer close(out) @@ -85,8 +85,8 @@ func OfSeq[T any](seq iter.Seq[T]) <-chan T { // OfSeq2 returns a channel containing the return values of the unmapper function // when provided with the values of the iterator -func OfSeq2[K comparable, V, T any](seq iter.Seq2[K, V], unmapper func(K, V) T) <-chan T { - out := make(chan T, 10) +func OfSeq2[K comparable, V, T any](seq iter.Seq2[K, V], buffer int, unmapper func(K, V) T) <-chan T { + out := make(chan T, buffer) go func() { defer close(out)