Skip to content

Hex.slice

Returns a section of a Bytes.Bytes value given a start/end bytes offset.

Imports

Named
import { Hex } from 'ox'

Examples

import { Hex } from 'ox'
 
Hex.slice('0x0123456789', 1, 4)
'0x234567'

Definition

function slice(
  value: Hex,
  start?: number | undefined,
  end?: number | undefined,
  options?: slice.Options,
): Hex

Source: src/core/Hex.ts

Parameters

value

  • Type: Hex

The Hex.Hex value to slice.

start

  • Type: number | undefined
  • Optional

The start offset (in bytes).

end

  • Type: number | undefined
  • Optional

The end offset (in bytes).

options

  • Type: slice.Options
  • Optional

Options.

options.strict

  • Type: boolean
  • Optional

Asserts that the sliced value is the same size as the given start/end offsets.

Return Type

The sliced Hex.Hex value.

Hex