> ## Documentation Index
> Fetch the complete documentation index at: https://docs.alumio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Map value using comparator

> Maps a value to the 'to' value based on the comparator.

export const FormField = ({property, label, required = false, diType, uiPatterns, children}) => {
  const patterns = Array.isArray(uiPatterns) ? uiPatterns : uiPatterns ? [uiPatterns] : [];
  return <div style={{
    margin: '1.5rem 0'
  }}>
      <div style={{
    display: 'flex',
    alignItems: 'baseline',
    flexWrap: 'wrap',
    gap: '0.5rem',
    marginBottom: '0.25rem'
  }}>
        <strong>{label}</strong>
        <span style={{
    fontSize: '0.7rem',
    fontWeight: 600,
    textTransform: 'uppercase',
    letterSpacing: '0.04em',
    color: required ? '#6241f5' : '#6b7280'
  }}>
          {required ? 'Required' : 'Optional'}
        </span>
      </div>

      <div>{children}</div>

      {diType || patterns.length > 0 ? <p style={{
    fontSize: '0.85rem',
    color: '#6b7280',
    marginBottom: 0
  }}>
          {diType ? <>
              See the <a href={`/references/${diType}`}>{diType}</a> reference.{' '}
            </> : null}
          {patterns.length > 0 ? <>
              Accepts a <a href={`/documentation/placeholders-and-patterns/patterns#${patterns[0]}`}>pattern</a>.
            </> : null}
        </p> : null}
    </div>;
};

Maps a value to the "to" value based on the comparator. You set a value to compare against, the replacement to use when it matches, and the comparator that decides what counts as a match. When the incoming value matches, it is swapped for the replacement; when it does not match, the original value passes through unchanged. This is the simplest building block for one-off replacements, such as turning a single status code into your own wording while leaving every other value untouched.

This documentation describes: [Schema](/schemas/mapper/standard)

## Fields

<FormField property="from" label="From" required>
  The value the incoming value is compared against. Choose the type that fits your data: text, number, true/false, or empty. When the incoming value matches this, it is replaced.
</FormField>

<FormField property="to" label="To" required>
  The replacement value used when the incoming value matches. Choose the type that fits your data: text, number, true/false, or empty.
</FormField>

<FormField property="comparator" label="Comparator" diType="comparator">
  Decides how the incoming value is compared against the "From" value. When left empty an exact equals check is used. Choose a different option here, such as case-insensitive or greater-than checks.
</FormField>

## Sample data

| Field      | Value     |
| ---------- | --------- |
| From       | `active`  |
| To         | `enabled` |
| Comparator | `equals`  |

A value that matches is replaced:

Input:

```json theme={null}
{ "status": "active" }
```

Output:

```json theme={null}
{ "status": "enabled" }
```

A non-matching value is left as it is (for example `"archived"` stays `"archived"`).

```json Configuration theme={null}
{
  "prototype": "standard",
  "parameters": {
    "from": "active",
    "to": "enabled",
    "comparator": "equals"
  }
}
```
