This is the ThingsDB documentation for version v0, click here for the latest version!

unwrap

Unwrap a wrapped thing.

Function

<Type>.unwrap()

Arguments

None

Return value

Returns the wrapped thing.

Example

This code shows an example using unwrap():

// 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',
};

// Wrap `joente` with the `_Email` type.
.w = .joente.wrap('_Email');

// Return the original `thing`
.w.unwrap();

Example return value in JSON format

{
    "#": 42,
    "name": "Jeroen van der Heijden",
    "email": "jeroen@transceptor.technology",
    "gender": "male"
}