ChiriVulpes / scryfall-sdk

A Node.js SDK for https://scryfall.com/docs/api, written in TypeScript.
MIT License
99 stars 16 forks source link

this._listeners[eventName] is not iterable #70

Closed ryder-james closed 9 months ago

ryder-james commented 9 months ago

Running a fairly simple search:

const commanders = [];
Scry.Cards.search('is:commander legal:commander game:paper')
    .on('data', card => {
        commanders.push(card);
    })
    .on('end', () => {
        console.log(`found ${commanders.length} results`);
    });

But getting this error:

<path>\node_modules\scryfall-sdk\out\util\EventEmitter.js:70
        for (const listener of this._listeners[eventName])
                                              ^

TypeError: this._listeners[eventName] is not iterable
    at MagicEmitter.emit (<path>\node_modules\scryfall-sdk\out\util\EventEmitter.js:70:47)
    at MagicEmitter.emit (<path>\node_modules\scryfall-sdk\out\util\MagicEmitter.js:51:22)
    at <path>\node_modules\scryfall-sdk\out\api\Cards.js:433:35
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
ChiriVulpes commented 9 months ago

Hmm, I think this is the same thing fixed by the suggested PR #69, I wonder why this wouldn't be covered by the existing tests. I'll take a look tomorrow. Thanks for the report!

ChiriVulpes commented 9 months ago

Fixed as of v4.2.2 via #69