MCPcopy Create free account
hub / github.com/DoNewsCode/core / KeepOdd

Function KeepOdd

key/key_manager.go:100–111  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

98// key-value pairs. To avoid confusion, the KeepEven method is intentionally not
99// provided.
100func 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}

Callers 2

UploadMethod · 0.92
ExampleKeepOddFunction · 0.92

Calls 1

SpreadMethod · 0.65

Tested by 1

ExampleKeepOddFunction · 0.74