Bytes.fromBoolean
Encodes a boolean value into Bytes.Bytes
.
Imports
Named
import { Bytes } from 'ox'
Examples
import { Bytes } from 'ox'
const data = Bytes.fromBoolean(true)
Uint8Array([1])
import { Bytes } from 'ox'
const data = Bytes.fromBoolean(true, { size: 32 })
Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1])
Definition
function fromBoolean(
value: boolean,
options?: fromBoolean.Options,
): Uint8Array
Source: src/core/Bytes.ts
Parameters
value
- Type:
boolean
Boolean value to encode.
options
- Type:
fromBoolean.Options
- Optional
Encoding options.
options.size
- Type:
number
- Optional
Size of the output bytes.
Return Type
Encoded Bytes.Bytes
.
Uint8Array