Skip to content

Hex.validate

Checks if the given value is Hex.Hex.

Imports

Named
import { Hex } from 'ox'

Examples

import { Bytes, Hex } from 'ox'
 
Hex.validate('0xdeadbeef')
true
Hex.validate(Bytes.from([1, 2, 3]))
false

Definition

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

Source: src/core/Hex.ts

Parameters

value

  • Type: unknown

The value to check.

options

  • Type: validate.Options
  • Optional

Options.

options.strict

  • Type: boolean
  • Optional

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

Return Type

true if the value is a Hex.Hex, false otherwise.

value is Hex