name: Vector
description: This manages codec arrays. Internally it keeps track of the length (as decoded) and allows construction with the passed Type in the constructor. It is an extension to Array, providing specific encoding/decoding on top of the base type.
Type parameters
T : Codec
Hierarchy
Array<T>
↳ Vector
Implements
Indexable
[n: number]: T
Constructors
constructor
⊕ new Vector(Type: Constructor<T>, value?: Vector<any> | Uint8Array | string | Array<any>): Vector
Defined in codec/Vector.ts:22
Parameters:
| Name | Type | Default value |
|---|---|---|
| Type | Constructor<T> | - |
Default value value | Vector<any> | Uint8Array | string | Array<any> | [] as Array<any> |
Returns: Vector
Properties
<Static> Array
● Array: ArrayConstructor
Defined in /home/travis/build/polkadot-js/api/node_modules/typescript/lib/lib.es5.d.ts:1368
Accessors
Type
get Type(): string
Defined in codec/Vector.ts:66
description: The type for the items
Returns: string
encodedLength
get encodedLength(): number
Defined in codec/Vector.ts:73
description: The length of the value when encoded as a Uint8Array
Returns: number
isEmpty
get isEmpty(): boolean
Defined in codec/Vector.ts:59
description: Checks if the value is an empty value
Returns: boolean
length
get length(): number
Overrides Array.length
Defined in codec/Vector.ts:82
description: The length of the value
Returns: number
Methods
eq
▸ eq(other?: any): boolean
Defined in codec/Vector.ts:90
description: Compares the value of the input to see if there is a match
Parameters:
| Name | Type |
|---|---|
Optional other | any |
Returns: boolean
filter
▸ filter(callbackfn: function, thisArg?: any): Array<T>
Overrides Array.filter
Defined in codec/Vector.ts:173
description: Filters the array with the callback
Parameters:
| Name | Type | Description |
|---|---|---|
| callbackfn | function | The filter function |
Optional thisArg | any | The `this` object to apply the result to |
Returns: Array<T>
indexOf
▸ indexOf(_other?: any): number
Overrides Array.indexOf
Defined in codec/Vector.ts:97
description: Finds the index of the value in the array
Parameters:
| Name | Type |
|---|---|
Optional _other | any |
Returns: number
map
▸ map<U>(callbackfn: function, thisArg?: any): Array<U>
Overrides Array.map
Defined in codec/Vector.ts:182
description: Maps the array with the callback
Type parameters:
U
Parameters:
| Name | Type | Description |
|---|---|---|
| callbackfn | function | The mapping function |
Optional thisArg | any | The `this` onject to apply the result to |
Returns: Array<U>
toArray
▸ toArray(): Array<T>
Defined in codec/Vector.ts:115
description: Converts the Object to an standard JavaScript Array
Returns: Array<T>
toHex
▸ toHex(): string
Defined in codec/Vector.ts:122
description: Returns a hex string representation of the value
Returns: string
toJSON
▸ toJSON(): any
Implementation of Codec.toJSON
Defined in codec/Vector.ts:129
description: Converts the Object to JSON, typically used for RPC transfers
Returns: any
toString
▸ toString(): string
Implementation of Codec.toString
Overrides Array.toString
Defined in codec/Vector.ts:138
description: Returns the string representation of the value
Returns: string
toU8a
▸ toU8a(isBare?: undefined | false | true): Uint8Array
Defined in codec/Vector.ts:151
description: Encodes the value as a Uint8Array as per the parity-codec specifications
Parameters:
| Name | Type | Description |
|---|---|---|
Optional isBare | undefined | false | true | true when the value has none of the type-specific prefixes (internal) |
Returns: Uint8Array
<Static> decodeVector
▸ decodeVector<T>(Type: Constructor<T>, value: Vector<any> | Uint8Array | string | Array<any>): Array<T>
Defined in codec/Vector.ts:32
Type parameters:
T : Codec
Parameters:
| Name | Type |
|---|---|
| Type | Constructor<T> |
| value | Vector<any> | Uint8Array | string | Array<any> |
Returns: Array<T>
<Static> with
▸ with<O>(Type: Constructor<O>): Constructor<Vector<O>>
Defined in codec/Vector.ts:48
Type parameters:
O : Codec
Parameters:
| Name | Type |
|---|---|
| Type | Constructor<O> |
Returns: Constructor<Vector<O>>