---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/vector/helpers/functions/sanitizeMetadata.md
---

# Function: sanitizeMetadata()

```ts
function sanitizeMetadata<T>(metadata: T): T;
```

Defined in: [src/batteries/vector/helpers.ts:68](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/batteries/vector/helpers.ts#L68)

Strip `__proto__`/`prototype`/`constructor` keys from caller-supplied metadata before an
adapter spreads or assigns it onto a record bound for storage. Every adapter's own-object
targets (`{}` literals) are already immune to prototype reassignment, but a stray
`__proto__`-keyed record would otherwise round-trip verbatim through storage and back out
to a caller — this keeps the stored shape honest regardless.

## Type Parameters

| Type Parameter                                                                                                                                     |
| -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `T` *extends* | [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)<`string`, `unknown`> | `undefined` |

## Parameters

| Parameter  | Type |
| ---------- | ---- |
| `metadata` | `T`  |

## Returns

`T`
