Skip to content

Hex.toNumber

Decodes a Hex.Hex value into a number.

Imports

Named
import { Hex } from 'ox'

Examples

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

Definition

function toNumber(
  hex: Hex,
  options?: toNumber.Options,
): number

Source: src/core/Hex.ts

Parameters

hex

  • Type: Hex

The Hex.Hex value to decode.

options

  • Type: toNumber.Options
  • Optional

Options.

Return Type

The decoded number.

number