]> git.immae.eu Git - github/fretlink/terraform-provider-statuscake.git/blobdiff - vendor/github.com/hashicorp/terraform/dag/set.go
Transfer of provider code
[github/fretlink/terraform-provider-statuscake.git] / vendor / github.com / hashicorp / terraform / dag / set.go
index 3929c9d0e9460b0f7fa7047519fe735a044b9c29..92b42151d75a9f1b3845d906798907130457fc6d 100644 (file)
@@ -81,6 +81,20 @@ func (s *Set) Difference(other *Set) *Set {
        return result
 }
 
+// Filter returns a set that contains the elements from the receiver
+// where the given callback returns true.
+func (s *Set) Filter(cb func(interface{}) bool) *Set {
+       result := new(Set)
+
+       for _, v := range s.m {
+               if cb(v) {
+                       result.Add(v)
+               }
+       }
+
+       return result
+}
+
 // Len is the number of items in the set.
 func (s *Set) Len() int {
        if s == nil {