# Hex.assert

Asserts if the given value is [`Hex.Hex`](/api/Hex/types#hex).

## Imports

:::code-group
```ts [Named]
import { Hex } from 'ox'
```

```ts [Entrypoint]
import * as Hex from 'ox/Hex'
```
:::

## Examples

```ts twoslash
import { Hex } from 'ox'

Hex.assert('abc')
// @error: InvalidHexValueTypeError:
// @error: Value `"abc"` of type `string` is an invalid hex type.
// @error: Hex types must be represented as `"0x\${string}"`.
```

## Definition

```ts
function assert(
  value: unknown,
  options?: assert.Options,
): asserts value is Hex
```

**Source:** [src/core/Hex.ts](https://github.com/wevm/ox/blob/main/src/core/Hex.ts#L1003)

## Parameters

### value

* **Type:** `unknown`

The value to assert.

### options

* **Type:** `assert.Options`
* **Optional**

Options.

#### options.strict

* **Type:** `boolean`
* **Optional**

Checks if the [`Hex.Hex`](/api/Hex/types#hex) value contains invalid hexadecimal characters.
