github.com/m4gshm/gollections@v0.0.10/map_/convert/api.go (about) 1 // Package convert provides key, value convert adapters 2 package convert 3 4 // Key adapts a key converter to the key/value converter that converts only keys 5 func Key[V, K, KOUT any](converter func(K) KOUT) (out func(key K, val V) (KOUT, V)) { 6 return func(key K, val V) (KOUT, V) { return converter(key), val } 7 } 8 9 // Value adapts a value converter to the key/value converter that converts only values 10 func Value[K, V, VOUT any](converter func(V) VOUT) (out func(key K, val V) (K, VOUT)) { 11 return func(key K, val V) (K, VOUT) { return key, converter(val) } 12 }