Copy a wrapped thing.
The function does not preserve the wrap or Type of a thing. Use dup(..) if you want a true duplicate.
This function does not generate a change.
<Type>
.copy([deep]])
Argument | Type | Description |
---|---|---|
deep | int (optional) | How deep to copy the wrapped thing. Default is 1 . |
A new thing.
This code shows an example using copy() on a wrapped thing:
set_type('Person', {
name: 'str'
});
robot = {
name: 'Foo',
isHuman: false
};
foo = robot.wrap('Person').copy();
foo; // note that only `name` is copied
Return value in JSON format
{
"name": "Foo"
}