diff --git a/src/index.js b/src/index.js index e112b57..9749669 100644 --- a/src/index.js +++ b/src/index.js @@ -18,7 +18,18 @@ const coderArray = utils.coderArray; const paramTypePart = utils.paramTypePart; const getParamCoder = utils.getParamCoder; -function Result() {} +function Result() { + this[Symbol.iterator] = () => { + const keys = Object.keys(this) + .filter(key => Number.isFinite(Number(key))) + return { + next: () => { + if (!keys.length) return { value: undefined, done: true } + return { value: this[keys.shift()], done: false } + } + } + } +} function encodeParams(types, values) { if (types.length !== values.length) {