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

def

Returns the closure definition using spaces, line-breaks and indentation (4 spaces).

This function does not generate an event.

Function

closure.def()

Arguments

None

Return value

Returns the closure definition.

Example

This code creates a closure with a doc string:

add_one = |x| {
    x + 1;
};

// Return the definition as a string
add_one.def();

Return value in JSON format

"|x| {\n    x + 1;\n}"

Or, when printed:

|x| {
    x + 1;
}