(collection, item interface{})
| 119 | } |
| 120 | |
| 121 | func Contains(collection, item interface{}) bool { |
| 122 | switch collection := collection.(type) { |
| 123 | case Map: |
| 124 | return collection.Has(item) |
| 125 | case []interface{}: |
| 126 | for _, val := range collection { |
| 127 | if val == item { |
| 128 | return true |
| 129 | } |
| 130 | } |
| 131 | return false |
| 132 | } |
| 133 | |
| 134 | panic("unexpected type passed to Contains") |
| 135 | } |
| 136 | |
| 137 | func Each(collection Map, cb Iterator) { |
| 138 | for _, key := range collection.Keys() { |