assign

Copies properties from a given thing. Existing properties will be overwritten and new properties will be added. If this function is used on a typed thing, all properties of the source must be valid according the type specification, otherwise an exception will be raised and no properties will be copied.

It is not possible to use assign(..) to set a property with a relation unless the source if of the same Type.

This function generates a change.

Function

thing.assign(source)

Arguments

Argument Type Description
source thing (required) Thing from which the properties are copied.

Return value

Returns the thing to which the properties are assigned.

Example

This code shows an example using assign():

scores = {
    iris: 10,
    job: 20
};

scores.assign({
    job: 80,
    tijs: 90
});

Return value in JSON format

{
    "iris": 10,
    "job": 80,
    "tijs": 90
}