this-value

The this-value cursor performs transformations only on the context object and does not iterate over its children.

Example

The code below uses the this-value cursor with the list-to-object transformer to reduce a list down to a single value.

from recompose import CursorSchema, transform

data = ["one", "two", "three "]

schema: CursorSchema = {
    "version": 1,
    "on": "this-value",
    "perform": "list-to-object",
}

transformed = transform(schema, data)
print(transformed)

Result

 one