UNPKG

625 BTypeScriptView Raw
1/**
2 * @name u8aFixLength
3 * @summary Shifts a Uint8Array to a specific bitLength
4 * @description
5 * Returns a uint8Array with the specified number of bits contained in the return value. (If bitLength is -1, length checking is not done). Values with more bits are trimmed to the specified length.
6 * @example
7 * <BR>
8 *
9 * ```javascript
10 * import { u8aFixLength } from '@polkadot/util';
11 *
12 * u8aFixLength('0x12') // => 0x12
13 * u8aFixLength('0x12', 16) // => 0x0012
14 * u8aFixLength('0x1234', 8) // => 0x12
15 * ```
16 */
17export declare function u8aFixLength(value: Uint8Array, bitLength?: number, atStart?: boolean): Uint8Array;