Skip to content

Hex.toBigInt

Decodes a Hex.Hex value into a BigInt.

Imports

Named
import { Hex } from 'ox'

Examples

import { Hex } from 'ox'
 
Hex.toBigInt('0x1a4')
420n
Hex.toBigInt('0x00000000000000000000000000000000000000000000000000000000000001a4', { size: 32 })
420n

Definition

function toBigInt(
  hex: Hex,
  options?: toBigInt.Options,
): bigint

Source: src/core/Hex.ts

Parameters

hex

  • Type: Hex

The Hex.Hex value to decode.

options

  • Type: toBigInt.Options
  • Optional

Options.

options.signed

  • Type: boolean
  • Optional

Whether or not the number of a signed representation.

options.size

  • Type: number
  • Optional

Size (in bytes) of the hex value.

Return Type

The decoded BigInt.

bigint