# Transforms

Declares transforms by name for use in policies, views, cursors, etc.

For backwards compatibility (cortex < 2.13.0), any transform not assigned a name takes on the export property of the library in which it is defined. A transform can extend require('runtime.transform').Transform or not. If it does, the transform can tweak the default limits for the each() cycle in the constructor.

```javascript
    @transform('test__expression_transform', {
        environment: 'development',
        if: { $gte: [ '$$RANDOM', 0.5] }
      })
      class TestTransform {
        result(data) {
          return 'replaced-result'
        }
        each(object, memo, { cursor }) {   
          return 'replaced-each'
        }
      }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.medable.com/cortex-api/expressions/transforms.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
