---
editLink: false
lastUpdated: false
---

[@salesforce/b2c-tooling-sdk](../../modules.md) / [safety](../index.md) / normalizeSafetyRule

# Function: normalizeSafetyRule()

> **normalizeSafetyRule**(`raw`): [`SafetyRule`](../interfaces/SafetyRule.md) \| `undefined`

Defined in: [packages/b2c-tooling-sdk/src/safety/types.ts:134](https://github.com/SalesforceCommerceCloud/b2c-developer-tooling/blob/d7ff38c7ca2b1411cd718b9554500c9416f00266/packages/b2c-tooling-sdk/src/safety/types.ts#L134)

Normalize one safety rule from untrusted JSON (dw.json, safety.json, normalized
config). Keeps only known fields with the right types and returns `undefined`
for a rule with an invalid action or a mistyped matcher, so a rule never
silently matches more than its author wrote.

## Parameters

### raw

`unknown`

## Returns

[`SafetyRule`](../interfaces/SafetyRule.md) \| `undefined`
