Skip to content

Make Results Iterable #12

@jozanza

Description

@jozanza

ethjs-abi

Before opening a new issue, please take a moment to review our community guidelines to make the contribution process easy and effective for everyone involved.

Before opening a new issue, you may find an answer in already closed issues:
https://github.com/ethjs/ethjs-abi/issues?q=is%3Aissue+is%3Aclosed

Issue Type

Description

I'd love to have Symbol.iterator implemented on the Result data structure. This would enable destructuring assignment, spreads, etc, when handling values returned from contracts. Additionally, iteration should only be performed over numerically indexed keys.

Steps to reproduce

Using the decodeParams function with any valid parameters, the following code will currently throw:

const [a, b, c] = decodeParams(...);

Only the following works currently:

const result = decodeParams(...);
const a = result[0]
const b = result[1]
const c = result[2]

Versions

  • Node/NPM: 8.6.0/yarn@1.1.0
  • Browser: any

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions