diff options
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/dag')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/dag/set.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/dag/set.go b/vendor/github.com/hashicorp/terraform/dag/set.go index 3929c9d..92b4215 100644 --- a/vendor/github.com/hashicorp/terraform/dag/set.go +++ b/vendor/github.com/hashicorp/terraform/dag/set.go | |||
@@ -81,6 +81,20 @@ func (s *Set) Difference(other *Set) *Set { | |||
81 | return result | 81 | return result |
82 | } | 82 | } |
83 | 83 | ||
84 | // Filter returns a set that contains the elements from the receiver | ||
85 | // where the given callback returns true. | ||
86 | func (s *Set) Filter(cb func(interface{}) bool) *Set { | ||
87 | result := new(Set) | ||
88 | |||
89 | for _, v := range s.m { | ||
90 | if cb(v) { | ||
91 | result.Add(v) | ||
92 | } | ||
93 | } | ||
94 | |||
95 | return result | ||
96 | } | ||
97 | |||
84 | // Len is the number of items in the set. | 98 | // Len is the number of items in the set. |
85 | func (s *Set) Len() int { | 99 | func (s *Set) Len() int { |
86 | if s == nil { | 100 | if s == nil { |