mirror of
https://github.com/samber/lo.git
synced 2026-04-22 23:47:11 +08:00
705 B
705 B
name, slug, sourceRef, category, subCategory, signatures, variantHelpers, similarHelpers, position
| name | slug | sourceRef | category | subCategory | signatures | variantHelpers | similarHelpers | position | |||
|---|---|---|---|---|---|---|---|---|---|---|---|
| DropWhile | dropwhile | it/seq.go#L180 | it | sequence |
|
|
162 |
DropWhile drops elements from the beginning of a sequence while the predicate returns true.
collection := func(yield func(int) bool) {
yield(1)
yield(2)
yield(3)
yield(4)
yield(5)
}
filtered := it.DropWhile(collection, func(x int) bool {
return x < 3
})
var result []int
for item := range filtered {
result = append(result, item)
}
// result contains [3, 4, 5]