TransformSlice applies the converter to each element in the input slice and returns a new slice.
(in []T, converter func(T) R)
| 8 | |
| 9 | // TransformSlice applies the converter to each element in the input slice and returns a new slice. |
| 10 | func TransformSlice[T any, R any](in []T, converter func(T) R) []R { |
| 11 | out := make([]R, len(in)) |
| 12 | for i, v := range in { |
| 13 | out[i] = converter(v) |
| 14 | } |
| 15 | return out |
| 16 | } |
| 17 | |
| 18 | // CanonicalMapIter returns an iterator that yields map entries in sorted key order. |
| 19 | // This ensures deterministic iteration over maps, which is useful for generating |
no outgoing calls
no test coverage detected