Make Results Iterable
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
- [ ] Bug (https://github.com/ethjs/ethjs-abi/blob/master/.github/CONTRIBUTING.md#bug-reports)
- [X] Feature (https://github.com/ethjs/ethjs-abi/blob/master/.github/CONTRIBUTING.md#feature-requests)
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/[email protected]
- Browser: any
Very nice! Will check it out on Monday!
Sent from my iPhone
On Nov 8, 2017, at 4:15 PM, Josiah Savary [email protected] wrote:
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
Bug (https://github.com/ethjs/ethjs-abi/blob/master/.github/CONTRIBUTING.md#bug-reports) Feature (https://github.com/ethjs/ethjs-abi/blob/master/.github/CONTRIBUTING.md#feature-requests) 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 values = decodeParams(...); const a = values[0] const b = values[1] const c = values[2] Versions
Node/NPM: 8.6.0/[email protected] Browser: any — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
@SilentCicero awesome. Keep me posted :)