Back to Lo

Core Fanout

docs/data/core-fanout.md

1.53.0245 B
Original Source

FanOut splits a single channel into multiple channels.

go
upstream := make(chan int, 6)
for i := 0; i < 6; i++ {
    upstream <- i
}
close(upstream)

downstreams := lo.FanOut(3, 10, upstream)
// Returns 3 channels, each receiving 2 items