A Result is a sub-class of Array, which allows accessing any of its values either positionally by its index or, if keys are provided by its name.

Extends

  • Array<any>

Methods

getValue()

getValue(name): any

Returns the value for name.

Since it is possible to have a key whose name conflicts with a method on a Result or its superclass Array, or any JavaScript keyword, this ensures all named values are still accessible by name.

Parameters

ParameterTypeDescription
namestringThe name of the value to retrieve.

Returns

any

The value for name.

Source

abi/coders/abstract-coder.ts:270


toArray()

toArray(): any[]

Returns the Result as a normal Array.

This will throw if there are any outstanding deferred errors.

Returns

any[]

Source

abi/coders/abstract-coder.ts:149


toObject()

toObject(): Record<string, any>

Returns the Result as an Object with each name-value pair.

This will throw if any value is unnamed, or if there are any outstanding deferred errors.

Returns

Record<string, any>

Source

abi/coders/abstract-coder.ts:165


fromItems()

static fromItems(items, keys?): Result

Creates a new Result for items with each entry also accessible by its corresponding name in keys.

Parameters

ParameterTypeDescription
itemsany[]The items to include in the Result.
keys?(null | string)[]The names for each item in items.

Returns

Result

The new Result.

Source

abi/coders/abstract-coder.ts:294