Clone
Overview
Clone returns a shallow copy of m (lodash clone).
If you are coming from Node.js, the closest pattern is _.cloneDeep(obj).
Signature
go
func Clone[K comparable, V any](m map[K]V) map[K]VCompare: Node.js · Standard Go · gox
js
_.cloneDeep(obj)go
// Use the underlying stdlib or driver directly.
// See package overview for escape hatches.go
import "github.com/sahilkhaire/gox/maputil"
maputil.Clone(obj)Example
go
import "github.com/sahilkhaire/gox/maputil"
maputil.Clone(obj)Tips
Import github.com/sahilkhaire/gox/maputil and call Clone directly. See the comparison below for the standard library equivalent.
Standard library alternative
gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.