Recently, I had to clone a nested array before I did some dangerous mutations. In my naivety, I thought Belt’s
copy would do a deep clone. As I found out that it mutated the state of my reducer, I checked the source and saw that it is just an external binding to
Array.prototype.slice (and thus only doing a shallow clone).
So what would be the right way to improve that? Add a
copyDeep method and just document that copy only does a shallow copy. Or would it be better if the default
copy was the deep one?