Files
common/docs/util/modules/_compact_striplength_.md
T
2018-12-06 11:08:26 +00:00

984 B

Functions

compactStripLength

▸ compactStripLength(input: Uint8Array, bitLength?: BitLength): [number, Uint8Array]

Defined in compact/stripLength.ts:22

name: compactStripLength

description: Removes the length prefix, returning both the total length (including the value + compact encoding) and the decoded value with the correct length

example:

import { compactStripLength } from '@polkadot/util';

console.log(compactStripLength(new Uint8Array([2 << 2, 0xde, 0xad]))); // [2, Uint8Array[0xde, 0xad]]

Parameters:

Name Type Default value
input Uint8Array -
Default value bitLength BitLength DEFAULT_BITLENGTH

Returns: [number, Uint8Array]