elvish/pkg/eval/vals/feed.go

12 lines
239 B
Go
Raw Normal View History

2020-09-03 12:22:06 +08:00
package vals
// Feed calls the function with given values, breaking earlier if the function
// returns false.
func Feed(f func(interface{}) bool, values ...interface{}) {
for _, value := range values {
if !f(value) {
break
}
}
}