| 50 | } |
| 51 | |
| 52 | func OrderedMap[K comparable, V any](orig *orderedmap.OrderedMap[K, V]) *orderedmap.OrderedMap[K, V] { |
| 53 | if orig.Len() == 0 { |
| 54 | return orderedmap.NewOrderedMap[K, V]() |
| 55 | } |
| 56 | c := orderedmap.NewOrderedMap[K, V]() |
| 57 | for pair := orig.Front(); pair != nil; pair = pair.Next() { |
| 58 | if copyable, ok := any(pair.Value).(Copier[V]); ok { |
| 59 | c.Set(pair.Key, copyable.DeepCopy()) |
| 60 | } else { |
| 61 | c.Set(pair.Key, pair.Value) |
| 62 | } |
| 63 | } |
| 64 | return c |
| 65 | } |
| 66 | |
| 67 | // TraverseStringsFunc runs the given function on every string in the given |
| 68 | // value by traversing it recursively. If the given value is a string, the |