Update docs
This commit is contained in:
parent
ab6543a74e
commit
142ac3d903
|
@ -18,20 +18,24 @@
|
|||
* [_isHexString](_src_base_.base.md#protected-_ishexstring)
|
||||
* [_log2](_src_base_.base.md#protected-_log2)
|
||||
* [_zip](_src_base_.base.md#protected-_zip)
|
||||
* [binarySearch](_src_base_.base.md#binarysearch)
|
||||
* [bufferToHex](_src_base_.base.md#buffertohex)
|
||||
* [bufferify](_src_base_.base.md#bufferify)
|
||||
* [bufferifyFn](_src_base_.base.md#bufferifyfn)
|
||||
* [linearSearch](_src_base_.base.md#linearsearch)
|
||||
* [print](_src_base_.base.md#print)
|
||||
* [binarySearch](_src_base_.base.md#static-binarysearch)
|
||||
* [bufferToHex](_src_base_.base.md#static-buffertohex)
|
||||
* [bufferify](_src_base_.base.md#static-bufferify)
|
||||
* [isHexString](_src_base_.base.md#static-ishexstring)
|
||||
* [linearSearch](_src_base_.base.md#static-linearsearch)
|
||||
* [print](_src_base_.base.md#static-print)
|
||||
|
||||
## Methods
|
||||
|
||||
### `Protected` _bufferIndexOf
|
||||
|
||||
▸ **_bufferIndexOf**(`array`: Buffer[], `element`: Buffer): *number*
|
||||
▸ **_bufferIndexOf**(`array`: Buffer[], `element`: Buffer, `isSorted`: boolean): *number*
|
||||
|
||||
bufferIndexOf
|
||||
|
||||
|
@ -44,10 +48,11 @@ const index = tree.bufferIndexOf(haystack, needle)
|
|||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`array` | Buffer[] |
|
||||
`element` | Buffer |
|
||||
Name | Type | Default |
|
||||
------ | ------ | ------ |
|
||||
`array` | Buffer[] | - |
|
||||
`element` | Buffer | - |
|
||||
`isSorted` | boolean | false |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
|
@ -121,6 +126,46 @@ Name | Type | Description |
|
|||
|
||||
___
|
||||
|
||||
### binarySearch
|
||||
|
||||
▸ **binarySearch**(`array`: Buffer[], `element`: Buffer, `compareFunction`: function): *number*
|
||||
|
||||
binarySearch
|
||||
|
||||
**`desc`** Returns the first index of which given item is found in array using binary search.
|
||||
|
||||
**`example`**
|
||||
```js
|
||||
const index = tree.binarySearch(array, element, Buffer.compare)
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
▪ **array**: *Buffer[]*
|
||||
|
||||
Array of items.
|
||||
|
||||
▪ **element**: *Buffer*
|
||||
|
||||
Item to find.
|
||||
|
||||
▪ **compareFunction**: *function*
|
||||
|
||||
▸ (`a`: unknown, `b`: unknown): *number*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`a` | unknown |
|
||||
`b` | unknown |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
- Index number
|
||||
|
||||
___
|
||||
|
||||
### bufferToHex
|
||||
|
||||
▸ **bufferToHex**(`value`: Buffer, `withPrefix`: boolean): *string*
|
||||
|
@ -191,6 +236,46 @@ Name | Type |
|
|||
|
||||
___
|
||||
|
||||
### linearSearch
|
||||
|
||||
▸ **linearSearch**(`array`: Buffer[], `element`: Buffer, `eqChecker`: function): *number*
|
||||
|
||||
linearSearch
|
||||
|
||||
**`desc`** Returns the first index of which given item is found in array using linear search.
|
||||
|
||||
**`example`**
|
||||
```js
|
||||
const index = tree.linearSearch(array, element, (a, b) => a === b)
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
▪ **array**: *Buffer[]*
|
||||
|
||||
Array of items.
|
||||
|
||||
▪ **element**: *Buffer*
|
||||
|
||||
Item to find.
|
||||
|
||||
▪ **eqChecker**: *function*
|
||||
|
||||
▸ (`a`: unknown, `b`: unknown): *boolean*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`a` | unknown |
|
||||
`b` | unknown |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
- Index number
|
||||
|
||||
___
|
||||
|
||||
### print
|
||||
|
||||
▸ **print**(): *void*
|
||||
|
@ -208,6 +293,46 @@ tree.print()
|
|||
|
||||
___
|
||||
|
||||
### `Static` binarySearch
|
||||
|
||||
▸ **binarySearch**(`array`: Buffer[], `element`: Buffer, `compareFunction`: function): *number*
|
||||
|
||||
binarySearch
|
||||
|
||||
**`desc`** Returns the first index of which given item is found in array using binary search.
|
||||
|
||||
**`example`**
|
||||
```js
|
||||
const index = MerkleTree.binarySearch(array, element, Buffer.compare)
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
▪ **array**: *Buffer[]*
|
||||
|
||||
Array of items.
|
||||
|
||||
▪ **element**: *Buffer*
|
||||
|
||||
Item to find.
|
||||
|
||||
▪ **compareFunction**: *function*
|
||||
|
||||
▸ (`a`: unknown, `b`: unknown): *number*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`a` | unknown |
|
||||
`b` | unknown |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
- Index number
|
||||
|
||||
___
|
||||
|
||||
### `Static` bufferToHex
|
||||
|
||||
▸ **bufferToHex**(`value`: Buffer, `withPrefix`: boolean): *string*
|
||||
|
@ -278,6 +403,46 @@ Name | Type |
|
|||
|
||||
___
|
||||
|
||||
### `Static` linearSearch
|
||||
|
||||
▸ **linearSearch**(`array`: Buffer[], `element`: Buffer, `eqChecker`: function): *number*
|
||||
|
||||
linearSearch
|
||||
|
||||
**`desc`** Returns the first index of which given item is found in array using linear search.
|
||||
|
||||
**`example`**
|
||||
```js
|
||||
const index = MerkleTree.linearSearch(array, element, (a, b) => a === b)
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
▪ **array**: *Buffer[]*
|
||||
|
||||
Array of items.
|
||||
|
||||
▪ **element**: *Buffer*
|
||||
|
||||
Item to find.
|
||||
|
||||
▪ **eqChecker**: *function*
|
||||
|
||||
▸ (`a`: unknown, `b`: unknown): *boolean*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`a` | unknown |
|
||||
`b` | unknown |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
- Index number
|
||||
|
||||
___
|
||||
|
||||
### `Static` print
|
||||
|
||||
▸ **print**(`tree`: any): *void*
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
* [_log2](_src_merklemountainrange_.merklemountainrange.md#protected-_log2)
|
||||
* [_zip](_src_merklemountainrange_.merklemountainrange.md#protected-_zip)
|
||||
* [append](_src_merklemountainrange_.merklemountainrange.md#append)
|
||||
* [binarySearch](_src_merklemountainrange_.merklemountainrange.md#binarysearch)
|
||||
* [bufferToHex](_src_merklemountainrange_.merklemountainrange.md#buffertohex)
|
||||
* [bufferify](_src_merklemountainrange_.merklemountainrange.md#bufferify)
|
||||
* [bufferifyFn](_src_merklemountainrange_.merklemountainrange.md#bufferifyfn)
|
||||
|
@ -50,6 +51,7 @@
|
|||
* [hashLeaf](_src_merklemountainrange_.merklemountainrange.md#hashleaf)
|
||||
* [heightAt](_src_merklemountainrange_.merklemountainrange.md#heightat)
|
||||
* [isLeaf](_src_merklemountainrange_.merklemountainrange.md#isleaf)
|
||||
* [linearSearch](_src_merklemountainrange_.merklemountainrange.md#linearsearch)
|
||||
* [mountainHeight](_src_merklemountainrange_.merklemountainrange.md#mountainheight)
|
||||
* [numOfPeaks](_src_merklemountainrange_.merklemountainrange.md#numofpeaks)
|
||||
* [peakBagging](_src_merklemountainrange_.merklemountainrange.md#peakbagging)
|
||||
|
@ -59,9 +61,11 @@
|
|||
* [print](_src_merklemountainrange_.merklemountainrange.md#print)
|
||||
* [rollUp](_src_merklemountainrange_.merklemountainrange.md#rollup)
|
||||
* [verify](_src_merklemountainrange_.merklemountainrange.md#verify)
|
||||
* [binarySearch](_src_merklemountainrange_.merklemountainrange.md#static-binarysearch)
|
||||
* [bufferToHex](_src_merklemountainrange_.merklemountainrange.md#static-buffertohex)
|
||||
* [bufferify](_src_merklemountainrange_.merklemountainrange.md#static-bufferify)
|
||||
* [isHexString](_src_merklemountainrange_.merklemountainrange.md#static-ishexstring)
|
||||
* [linearSearch](_src_merklemountainrange_.merklemountainrange.md#static-linearsearch)
|
||||
* [print](_src_merklemountainrange_.merklemountainrange.md#static-print)
|
||||
|
||||
## Constructors
|
||||
|
@ -134,7 +138,7 @@ ___
|
|||
|
||||
### `Protected` _bufferIndexOf
|
||||
|
||||
▸ **_bufferIndexOf**(`array`: Buffer[], `element`: Buffer): *number*
|
||||
▸ **_bufferIndexOf**(`array`: Buffer[], `element`: Buffer, `isSorted`: boolean): *number*
|
||||
|
||||
*Inherited from [Base](_src_base_.base.md).[_bufferIndexOf](_src_base_.base.md#protected-_bufferindexof)*
|
||||
|
||||
|
@ -149,10 +153,11 @@ const index = tree.bufferIndexOf(haystack, needle)
|
|||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`array` | Buffer[] |
|
||||
`element` | Buffer |
|
||||
Name | Type | Default |
|
||||
------ | ------ | ------ |
|
||||
`array` | Buffer[] | - |
|
||||
`element` | Buffer | - |
|
||||
`isSorted` | boolean | false |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
|
@ -249,6 +254,48 @@ Name | Type |
|
|||
|
||||
___
|
||||
|
||||
### binarySearch
|
||||
|
||||
▸ **binarySearch**(`array`: Buffer[], `element`: Buffer, `compareFunction`: function): *number*
|
||||
|
||||
*Inherited from [Base](_src_base_.base.md).[binarySearch](_src_base_.base.md#static-binarysearch)*
|
||||
|
||||
binarySearch
|
||||
|
||||
**`desc`** Returns the first index of which given item is found in array using binary search.
|
||||
|
||||
**`example`**
|
||||
```js
|
||||
const index = tree.binarySearch(array, element, Buffer.compare)
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
▪ **array**: *Buffer[]*
|
||||
|
||||
Array of items.
|
||||
|
||||
▪ **element**: *Buffer*
|
||||
|
||||
Item to find.
|
||||
|
||||
▪ **compareFunction**: *function*
|
||||
|
||||
▸ (`a`: unknown, `b`: unknown): *number*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`a` | unknown |
|
||||
`b` | unknown |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
- Index number
|
||||
|
||||
___
|
||||
|
||||
### bufferToHex
|
||||
|
||||
▸ **bufferToHex**(`value`: Buffer, `withPrefix`: boolean): *string*
|
||||
|
@ -523,6 +570,48 @@ Name | Type |
|
|||
|
||||
___
|
||||
|
||||
### linearSearch
|
||||
|
||||
▸ **linearSearch**(`array`: Buffer[], `element`: Buffer, `eqChecker`: function): *number*
|
||||
|
||||
*Inherited from [Base](_src_base_.base.md).[linearSearch](_src_base_.base.md#static-linearsearch)*
|
||||
|
||||
linearSearch
|
||||
|
||||
**`desc`** Returns the first index of which given item is found in array using linear search.
|
||||
|
||||
**`example`**
|
||||
```js
|
||||
const index = tree.linearSearch(array, element, (a, b) => a === b)
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
▪ **array**: *Buffer[]*
|
||||
|
||||
Array of items.
|
||||
|
||||
▪ **element**: *Buffer*
|
||||
|
||||
Item to find.
|
||||
|
||||
▪ **eqChecker**: *function*
|
||||
|
||||
▸ (`a`: unknown, `b`: unknown): *boolean*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`a` | unknown |
|
||||
`b` | unknown |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
- Index number
|
||||
|
||||
___
|
||||
|
||||
### mountainHeight
|
||||
|
||||
▸ **mountainHeight**(`size`: number): *number*
|
||||
|
@ -671,6 +760,48 @@ Name | Type |
|
|||
|
||||
___
|
||||
|
||||
### `Static` binarySearch
|
||||
|
||||
▸ **binarySearch**(`array`: Buffer[], `element`: Buffer, `compareFunction`: function): *number*
|
||||
|
||||
*Inherited from [Base](_src_base_.base.md).[binarySearch](_src_base_.base.md#static-binarysearch)*
|
||||
|
||||
binarySearch
|
||||
|
||||
**`desc`** Returns the first index of which given item is found in array using binary search.
|
||||
|
||||
**`example`**
|
||||
```js
|
||||
const index = MerkleTree.binarySearch(array, element, Buffer.compare)
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
▪ **array**: *Buffer[]*
|
||||
|
||||
Array of items.
|
||||
|
||||
▪ **element**: *Buffer*
|
||||
|
||||
Item to find.
|
||||
|
||||
▪ **compareFunction**: *function*
|
||||
|
||||
▸ (`a`: unknown, `b`: unknown): *number*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`a` | unknown |
|
||||
`b` | unknown |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
- Index number
|
||||
|
||||
___
|
||||
|
||||
### `Static` bufferToHex
|
||||
|
||||
▸ **bufferToHex**(`value`: Buffer, `withPrefix`: boolean): *string*
|
||||
|
@ -747,6 +878,48 @@ Name | Type |
|
|||
|
||||
___
|
||||
|
||||
### `Static` linearSearch
|
||||
|
||||
▸ **linearSearch**(`array`: Buffer[], `element`: Buffer, `eqChecker`: function): *number*
|
||||
|
||||
*Inherited from [Base](_src_base_.base.md).[linearSearch](_src_base_.base.md#static-linearsearch)*
|
||||
|
||||
linearSearch
|
||||
|
||||
**`desc`** Returns the first index of which given item is found in array using linear search.
|
||||
|
||||
**`example`**
|
||||
```js
|
||||
const index = MerkleTree.linearSearch(array, element, (a, b) => a === b)
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
▪ **array**: *Buffer[]*
|
||||
|
||||
Array of items.
|
||||
|
||||
▪ **element**: *Buffer*
|
||||
|
||||
Item to find.
|
||||
|
||||
▪ **eqChecker**: *function*
|
||||
|
||||
▸ (`a`: unknown, `b`: unknown): *boolean*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`a` | unknown |
|
||||
`b` | unknown |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
- Index number
|
||||
|
||||
___
|
||||
|
||||
### `Static` print
|
||||
|
||||
▸ **print**(`tree`: any): *void*
|
||||
|
|
|
@ -27,6 +27,7 @@ Class reprensenting a Merkle Tree
|
|||
* [_zip](_src_merkletree_.merkletree.md#protected-_zip)
|
||||
* [addLeaf](_src_merkletree_.merkletree.md#addleaf)
|
||||
* [addLeaves](_src_merkletree_.merkletree.md#addleaves)
|
||||
* [binarySearch](_src_merkletree_.merkletree.md#binarysearch)
|
||||
* [bufferToHex](_src_merkletree_.merkletree.md#buffertohex)
|
||||
* [bufferify](_src_merkletree_.merkletree.md#bufferify)
|
||||
* [bufferifyFn](_src_merkletree_.merkletree.md#bufferifyfn)
|
||||
|
@ -55,16 +56,19 @@ Class reprensenting a Merkle Tree
|
|||
* [getProofsDFS](_src_merkletree_.merkletree.md#getproofsdfs)
|
||||
* [getRoot](_src_merkletree_.merkletree.md#getroot)
|
||||
* [isUnevenTree](_src_merkletree_.merkletree.md#isuneventree)
|
||||
* [linearSearch](_src_merkletree_.merkletree.md#linearsearch)
|
||||
* [print](_src_merkletree_.merkletree.md#print)
|
||||
* [resetTree](_src_merkletree_.merkletree.md#resettree)
|
||||
* [toString](_src_merkletree_.merkletree.md#tostring)
|
||||
* [verify](_src_merkletree_.merkletree.md#verify)
|
||||
* [verifyMultiProof](_src_merkletree_.merkletree.md#verifymultiproof)
|
||||
* [verifyMultiProofWithFlags](_src_merkletree_.merkletree.md#verifymultiproofwithflags)
|
||||
* [binarySearch](_src_merkletree_.merkletree.md#static-binarysearch)
|
||||
* [bufferToHex](_src_merkletree_.merkletree.md#static-buffertohex)
|
||||
* [bufferify](_src_merkletree_.merkletree.md#static-bufferify)
|
||||
* [getMultiProof](_src_merkletree_.merkletree.md#static-getmultiproof)
|
||||
* [isHexString](_src_merkletree_.merkletree.md#static-ishexstring)
|
||||
* [linearSearch](_src_merkletree_.merkletree.md#static-linearsearch)
|
||||
* [marshalLeaves](_src_merkletree_.merkletree.md#static-marshalleaves)
|
||||
* [marshalProof](_src_merkletree_.merkletree.md#static-marshalproof)
|
||||
* [print](_src_merkletree_.merkletree.md#static-print)
|
||||
|
@ -111,7 +115,7 @@ Name | Type | Default | Description |
|
|||
|
||||
### `Protected` _bufferIndexOf
|
||||
|
||||
▸ **_bufferIndexOf**(`array`: Buffer[], `element`: Buffer): *number*
|
||||
▸ **_bufferIndexOf**(`array`: Buffer[], `element`: Buffer, `isSorted`: boolean): *number*
|
||||
|
||||
*Inherited from [Base](_src_base_.base.md).[_bufferIndexOf](_src_base_.base.md#protected-_bufferindexof)*
|
||||
|
||||
|
@ -126,10 +130,11 @@ const index = tree.bufferIndexOf(haystack, needle)
|
|||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`array` | Buffer[] |
|
||||
`element` | Buffer |
|
||||
Name | Type | Default |
|
||||
------ | ------ | ------ |
|
||||
`array` | Buffer[] | - |
|
||||
`element` | Buffer | - |
|
||||
`isSorted` | boolean | false |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
|
@ -274,6 +279,48 @@ Name | Type | Default |
|
|||
|
||||
___
|
||||
|
||||
### binarySearch
|
||||
|
||||
▸ **binarySearch**(`array`: Buffer[], `element`: Buffer, `compareFunction`: function): *number*
|
||||
|
||||
*Inherited from [Base](_src_base_.base.md).[binarySearch](_src_base_.base.md#static-binarysearch)*
|
||||
|
||||
binarySearch
|
||||
|
||||
**`desc`** Returns the first index of which given item is found in array using binary search.
|
||||
|
||||
**`example`**
|
||||
```js
|
||||
const index = tree.binarySearch(array, element, Buffer.compare)
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
▪ **array**: *Buffer[]*
|
||||
|
||||
Array of items.
|
||||
|
||||
▪ **element**: *Buffer*
|
||||
|
||||
Item to find.
|
||||
|
||||
▪ **compareFunction**: *function*
|
||||
|
||||
▸ (`a`: unknown, `b`: unknown): *number*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`a` | unknown |
|
||||
`b` | unknown |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
- Index number
|
||||
|
||||
___
|
||||
|
||||
### bufferToHex
|
||||
|
||||
▸ **bufferToHex**(`value`: Buffer, `withPrefix`: boolean): *string*
|
||||
|
@ -893,6 +940,48 @@ Name | Type |
|
|||
|
||||
___
|
||||
|
||||
### linearSearch
|
||||
|
||||
▸ **linearSearch**(`array`: Buffer[], `element`: Buffer, `eqChecker`: function): *number*
|
||||
|
||||
*Inherited from [Base](_src_base_.base.md).[linearSearch](_src_base_.base.md#static-linearsearch)*
|
||||
|
||||
linearSearch
|
||||
|
||||
**`desc`** Returns the first index of which given item is found in array using linear search.
|
||||
|
||||
**`example`**
|
||||
```js
|
||||
const index = tree.linearSearch(array, element, (a, b) => a === b)
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
▪ **array**: *Buffer[]*
|
||||
|
||||
Array of items.
|
||||
|
||||
▪ **element**: *Buffer*
|
||||
|
||||
Item to find.
|
||||
|
||||
▪ **eqChecker**: *function*
|
||||
|
||||
▸ (`a`: unknown, `b`: unknown): *boolean*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`a` | unknown |
|
||||
`b` | unknown |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
- Index number
|
||||
|
||||
___
|
||||
|
||||
### print
|
||||
|
||||
▸ **print**(): *void*
|
||||
|
@ -1025,6 +1114,48 @@ Name | Type |
|
|||
|
||||
___
|
||||
|
||||
### `Static` binarySearch
|
||||
|
||||
▸ **binarySearch**(`array`: Buffer[], `element`: Buffer, `compareFunction`: function): *number*
|
||||
|
||||
*Inherited from [Base](_src_base_.base.md).[binarySearch](_src_base_.base.md#static-binarysearch)*
|
||||
|
||||
binarySearch
|
||||
|
||||
**`desc`** Returns the first index of which given item is found in array using binary search.
|
||||
|
||||
**`example`**
|
||||
```js
|
||||
const index = MerkleTree.binarySearch(array, element, Buffer.compare)
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
▪ **array**: *Buffer[]*
|
||||
|
||||
Array of items.
|
||||
|
||||
▪ **element**: *Buffer*
|
||||
|
||||
Item to find.
|
||||
|
||||
▪ **compareFunction**: *function*
|
||||
|
||||
▸ (`a`: unknown, `b`: unknown): *number*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`a` | unknown |
|
||||
`b` | unknown |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
- Index number
|
||||
|
||||
___
|
||||
|
||||
### `Static` bufferToHex
|
||||
|
||||
▸ **bufferToHex**(`value`: Buffer, `withPrefix`: boolean): *string*
|
||||
|
@ -1129,6 +1260,48 @@ Name | Type |
|
|||
|
||||
___
|
||||
|
||||
### `Static` linearSearch
|
||||
|
||||
▸ **linearSearch**(`array`: Buffer[], `element`: Buffer, `eqChecker`: function): *number*
|
||||
|
||||
*Inherited from [Base](_src_base_.base.md).[linearSearch](_src_base_.base.md#static-linearsearch)*
|
||||
|
||||
linearSearch
|
||||
|
||||
**`desc`** Returns the first index of which given item is found in array using linear search.
|
||||
|
||||
**`example`**
|
||||
```js
|
||||
const index = MerkleTree.linearSearch(array, element, (a, b) => a === b)
|
||||
```
|
||||
|
||||
**Parameters:**
|
||||
|
||||
▪ **array**: *Buffer[]*
|
||||
|
||||
Array of items.
|
||||
|
||||
▪ **element**: *Buffer*
|
||||
|
||||
Item to find.
|
||||
|
||||
▪ **eqChecker**: *function*
|
||||
|
||||
▸ (`a`: unknown, `b`: unknown): *boolean*
|
||||
|
||||
**Parameters:**
|
||||
|
||||
Name | Type |
|
||||
------ | ------ |
|
||||
`a` | unknown |
|
||||
`b` | unknown |
|
||||
|
||||
**Returns:** *number*
|
||||
|
||||
- Index number
|
||||
|
||||
___
|
||||
|
||||
### `Static` marshalLeaves
|
||||
|
||||
▸ **marshalLeaves**(`leaves`: any[]): *string*
|
||||
|
|
Loading…
Reference in New Issue