Skip to content

Hash.validate

Checks if a string is a valid hash value.

Imports

Named
import { Hash } from 'ox'

Examples

import { Hash } from 'ox'
 
Hash.validate('0x')
false
Hash.validate('0x3ea2f1d0abf3fc66cf29eebb70cbd4e7fe762ef8a09bcc06c8edf641230afec0')
true

Definition

function validate(
  value: string,
): value is Hex.Hex

Source: src/core/Hash.ts

Parameters

value

  • Type: string

Value to check.

Return Type

Whether the value is a valid hash.

value is Hex.Hex