Files
common/docs/trie-hash/modules/_util_sharedlength_.md
T
2018-11-21 14:46:15 +00:00

862 B

Functions

getSharedLength

▸ getSharedLength(a: Uint8Array, b: Uint8Array): number

Defined in util/sharedLength.ts:13

name: getSharedLength

signature: getSharedLength (a: Uint8Array, b: Uint8Array): number

summary: Returns the highest shared index of two u8a's where the values in lesser indexes are the same. Given two u8a's, it first determines the u8a with the shortest length, then iterates through each u8a up to that length. If the value in both u8a's is the same for a certain index, it returns that index, otherwise it returns the shortest length.

Parameters:

Name Type
a Uint8Array
b Uint8Array

Returns: number