Skip to content

Hex.toBoolean

Decodes a Hex.Hex value into a boolean.

Imports

Named
import { Hex } from 'ox'

Examples

import { Hex } from 'ox'
 
Hex.toBoolean('0x01')
true
Hex.toBoolean('0x0000000000000000000000000000000000000000000000000000000000000001', { size: 32 })
true

Definition

function toBoolean(
  hex: Hex,
  options?: toBoolean.Options,
): boolean

Source: src/core/Hex.ts

Parameters

hex

  • Type: Hex

The Hex.Hex value to decode.

options

  • Type: toBoolean.Options
  • Optional

Options.

options.size

  • Type: number
  • Optional

Size (in bytes) of the hex value.

Return Type

The decoded boolean.

boolean