KeepOdd only retains the odd values in the contract.Keyer. Note: The alternating key-values count from zero. Odd values are the "value" in key-value pairs. To avoid confusion, the KeepEven method is intentionally not provided.
(k contract.Keyer)
| 98 | // key-value pairs. To avoid confusion, the KeepEven method is intentionally not |
| 99 | // provided. |
| 100 | func KeepOdd(k contract.Keyer) contract.Keyer { |
| 101 | var ( |
| 102 | spreader = k.Spread() |
| 103 | km = manager{} |
| 104 | ) |
| 105 | for i := range spreader { |
| 106 | if i%2 == 1 { |
| 107 | km.Prefixes = append(km.Prefixes, spreader[i]) |
| 108 | } |
| 109 | } |
| 110 | return km |
| 111 | } |