Skip to content

Hex.assert

Asserts if the given value is Hex.Hex.

Imports

Named
import { Hex } from 'ox'

Examples

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

Definition

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

Source: src/core/Hex.ts

Parameters

value

  • Type: unknown

The value to assert.

options

  • Type: assert.Options
  • Optional

Options.

options.strict

  • Type: boolean
  • Optional

Checks if the Hex.Hex value contains invalid hexadecimal characters.