copy

Copy a wrapped thing to a new thing including the outcome of computed properts.

This function does not generate a change.

Function

<Type>.copy([deep]])

Arguments

Argument Type Description
deep int (optional) How deep to copy the wrapped thing. Default is 1.

Return value

A new thing.

Example

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"
}