Wrap a thing with a another Type to filter out properties, while preserving the Id. A wrapped thing inherits the methods from the type it is wrapped with.
For a more advanced example using wrap() and unwrap() see <Type>.
thing.wrap(Type)
Argument | Arguments | Description |
---|---|---|
Type | str | Type’s name to wrap the thing with. |
A wrapped thing.
This code shows an example using wrap():
// Create a Type to return just an email field.
set_type('_Email', {email: 'str'});
// Store a thing
.joente = {
name: 'Jeroen van der Heijden',
email: 'jeroen@transceptor.technology',
gender: 'male',
};
// Return the email field and Id (#)
.joente.wrap('_Email');
Example return value in JSON format
{
"#": 42,
"email": "jeroen@transceptor.technology"
}