UNPKG

@tetcoin/util

Version:
18 lines (17 loc) 628 B
/// <reference types="node" /> /** * @name u8aToU8a * @summary Creates a Uint8Array value from a Uint8Array, Buffer, string or hex input. * @description * `null` ior `undefined` nputs returns a `[]` result, Uint8Array values returns the value, hex strings returns a Uint8Array representation. * @example * <BR> * * ```javascript * import { u8aToU8a } from '@tetcoin/util'; * * u8aToU8a(new Uint8Array([0x12, 0x34]); // => Uint8Array([0x12, 0x34]) * u8aToU8a(0x1234); // => Uint8Array([0x12, 0x34]) * ``` */ export default function u8aToU8a(value?: Array<number> | Buffer | Uint8Array | string | null): Uint8Array;