Filter removes all attributes that do not satisfy the predicate function.
(pred func(*Attribute) bool)
| 123 | |
| 124 | // Filter removes all attributes that do not satisfy the predicate function. |
| 125 | func (a *Attributes) Filter(pred func(*Attribute) bool) { |
| 126 | a.s = slices.DeleteFunc(a.s, func(attr *Attribute) bool { |
| 127 | del := !pred(attr) |
| 128 | if del { |
| 129 | delete(a.m, attr.Name) |
| 130 | } |
| 131 | return del |
| 132 | }) |
| 133 | } |
| 134 | |
| 135 | // Sort sorts the attributes according to the provided function. |
| 136 | func (a *Attributes) Sort(cmp func(i, j *Attribute) int) { |
nothing calls this directly
no outgoing calls
no test coverage detected