github.com/hyperledger/aries-framework-go@v0.3.2/pkg/common/utils/map.go (about) 1 /* 2 Copyright SecureKey Technologies Inc. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package utils 8 9 // CopyMap performs shallow copy of map and nested maps. 10 func CopyMap(m map[string]interface{}) map[string]interface{} { 11 cm := make(map[string]interface{}) 12 13 for k, v := range m { 14 vm, ok := v.(map[string]interface{}) 15 if ok { 16 cm[k] = CopyMap(vm) 17 } else { 18 cm[k] = v 19 } 20 } 21 22 return cm 23 }