How do I clone an object in Motoko?

For example, I have some object literal (a record), and I want to make a (shallow or deep) copy of it.

2 Likes

Unfortunately not…we’ve been hitting the same walls and unfortunately there’s no magic way (yet). You’ll have to manually create a new object.

2 Likes

Damn… I don’t even think there’s a way to iterate over the properties of an object, so I can’t implement an Object.assign even if I wanted to…