Skip to content

Hex.fromBoolean

Encodes a boolean into a Hex.Hex value.

Imports

Named
import { Hex } from 'ox'

Examples

import { Hex } from 'ox'
 
Hex.fromBoolean(true)
'0x1'
Hex.fromBoolean(false)
'0x0'
Hex.fromBoolean(true, { size: 32 })
'0x0000000000000000000000000000000000000000000000000000000000000001'

Definition

function fromBoolean(
  value: boolean,
  options?: fromBoolean.Options,
): Hex

Source: src/Hex.ts

Parameters

value

  • Type: boolean

The boolean value to encode.

options

  • Type: fromBoolean.Options
  • Optional

Options.

options.size

  • Type: number
  • Optional

The size (in bytes) of the output hex value.

Return Type

The encoded Hex.Hex value.

Hex