github.com/seeker-insurance/kit@v0.0.13/functools/bool.go (about)

     1  package functools
     2  
     3  //All returns false if any predicate is false. All() is True.
     4  func All(bools ...bool) bool {
     5  	for _, b := range bools {
     6  		if !b {
     7  			return false
     8  		}
     9  	}
    10  	return true
    11  }
    12  
    13  //Any returns true if any predicate is true. Any() is False.
    14  func Any(bools ...bool) bool {
    15  	for _, b := range bools {
    16  		if b {
    17  			return true
    18  		}
    19  	}
    20  	return false
    21  }
    22  
    23  //None returns true if all predicates are false. None() is True.
    24  func None(bools ...bool) bool {
    25  	for _, b := range bools {
    26  		if b {
    27  			return false
    28  		}
    29  	}
    30  	return true
    31  }